package rebelsky.dict; import rebelsky.io.Pen; /** * A simple test of my hash table. Hashes and then looks up all * of the words presented on the command line. * * For example * ji rebelsky.dict.HashTable hello goodbye sam rebelsky today * * @author Samuel A. Rebelsky * @version 1.0 of November 2004 */ public class TestHT { public static void main(String[] args) { HashTable ht = new HashTable(); Pen pen = new Pen(); for (int i = 0; i < args.length; i++) { Object value = new Integer(i); pen.println("Setting " + args[i] + " to " + value); try { ht.set(args[i], value); } catch (Exception e) { pen.println("FAILED because " + e.toString()); } // catch } // for for (int i = 0; i < args.length; i++) { pen.println("Getting " + args[i]); try { pen.println(ht.find(args[i])); } catch (Exception e) { pen.println("FAILED because " + e.toString()); } // catch } // for } // main(String[]) } // class TestHT