public static void main(String[] args) { MyHashTable ht = new MyHashTable(); for (int i = 0; i < 87; i++) { ht.put("" + i, 87 - i); } System.out.println(ht); for (int i = 0; i < 87; i++) { ht.remove("" + i); } System.out.println(); System.out.println(); System.out.println(); System.out.println(ht); }
/** * Test main method tests each method in the class. * * @param args - Command line arguments */ public static void main(String[] args) { MyHashTable<String, Integer> table = new MyHashTable<String, Integer>(10); for (int i = 0; i < 15; i++) { table.put(String.valueOf(i), (Integer) i); // rehash will be called } table.put(String.valueOf(11), 11); System.out.println(table.toString()); System.out.println(table.containsValue(11)); System.out.println(table.containsValue(100)); System.out.println(table.size()); table.clear(); System.out.println(table.isEmpty()); table.put(String.valueOf(1), 0); table.put(String.valueOf(1), 1); table.put(String.valueOf(1), 2); System.out.println(table.getAll(String.valueOf(1))); System.out.println(table.getAll(String.valueOf(10))); }