home *** CD-ROM | disk | FTP | other *** search
Java Source | 1995-12-31 | 1018 b | 34 lines |
- import java.util.Hashtable;
- /* hashing_fun class */
- class hashing_fun {
-
- static public void main(String args[]) {
-
- /* create the new hash table */
- Hashtable theTable = new Hashtable();
- info_about person[] = new info_about[6];
-
- /* this will be the tester object */
- info_about X = new info_about("Pat");
-
- /* populate some people */
- person[0] = new info_about("Paul Tyma");
- person[1] = new info_about("Gabriel Torok");
- person[2] = new info_about("Billy Leach");
- person[3] = new info_about("Patrick Doughty");
- person[4] = new info_about("Troy Downing");
- person[5] = new info_about("Yasha Dupa");
-
- /* put the people on the hash table */
- for (int g=0;g<6;++g) {
- theTable.put(person[g],person[g]);
- }
-
- /* Find X */
- info_about A = (info_about)theTable.get(X);
-
- if (A == null) System.out.println("A is null");
- else System.out.println(A.name);
- }
- }
-