package rebelsky.exam4; import java.io.PrintWriter; /** * A very simple test of linear-probe hash tables. Shoves in * all the integer values specified on the command line as keys * (using the position as the corresponding value). * * @author Samuel A. Rebelsky * @version 1.0 of November 2005 */ public class TestLPHT1 { public static void main(String[] args) { PrintWriter pen = new PrintWriter(System.out, true); LinearProbeHashTable lpht = new LinearProbeHashTable(10); for (int i = 0; i < args.length; i++) { pen.println("Putting " + args[i]); try { lpht.put(new Integer(args[i]), new Integer(i)); } catch (Exception e) { pen.println("Failed to put " + args[i]); } pen.println(" " + lpht); } } // main(String[]) } // class TestLPHT1