@Test public void testStringLongHashtable() { StringLongHashtable ht = new StringLongHashtable(); System.out.println("Test put method"); ht.put("A", 100); ht.put("B", 200); ht.put("C", 300); ht.put("D", 400); test(ht, "A", 100); test(ht, "B", 200); test(ht, "C", 300); test(ht, "D", 400); try { long value = ht.get("G"); Assert.fail("The value "+value+" was found at key "+ "G, but there should not have been a value there."); } catch(NoValueException ex) { } System.out.println("Test contains method"); testContains(ht, new String[]{"A","B","C","D"}, "Add"); System.out.println("Test size method"); if (ht.size() != 4) { Assert.fail("size should be 4, but it is "+ht.size()); } System.out.println("Test remove"); ht.remove("B"); if (ht.size() != 3) { Assert.fail("size should be 3, but it is "+ht.size()); } testContains(ht, new String[]{"A","C","D"}, "Remove"); System.out.println("Test removeAll"); ht.removeAll(); if (ht.size() != 0) { Assert.fail("size should be 0, but it is "+ht.size()); } testContains(ht,new String[]{}, "RemoveAll"); System.out.println("Test grow by adding 500 values"); for(int i=0;i<500;i++) { ht.put("LAB"+(100*i), i); } for(int i= 0;i<50000;i++) { if (ht.contains("LAB"+i)) { if (i%100 != 0) { Assert.fail("hashtable contains key "+i+", but it shouldn't"); } } else { if (i%100 == 0) { Assert.fail("hashtable should contain key "+i+", but it doesn't"); } } } }
public StringLongHashtable() { this((short)3); }
StringLongHashtable implements Serializable { public StringLongHashtable() { this((short)3); } }
StringLongHashtable implements Serializable { public StringLongHashtable() { this((short)3); } StringLongHashtable();  StringLongHashtable(int capacity); }
StringLongHashtable implements Serializable { public StringLongHashtable() { this((short)3); } StringLongHashtable();  StringLongHashtable(int capacity); void put(String key, long value); long get(String key); Iterator<String> getKeyIterator(); boolean remove(String key); void removeAll(); boolean contains(String key); int size(); String[] getKeys(); }
StringLongHashtable implements Serializable { public StringLongHashtable() { this((short)3); } StringLongHashtable();  StringLongHashtable(int capacity); void put(String key, long value); long get(String key); Iterator<String> getKeyIterator(); boolean remove(String key); void removeAll(); boolean contains(String key); int size(); String[] getKeys();  }