@Test public void testLongShortHashtable() { LongShortHashtable ht = new LongShortHashtable(); System.out.println("Test put method"); ht.put(10000, (short)100); ht.put(20000, (short)200); ht.put(30000, (short)300); ht.put(40000, (short)400); test(ht, 10000, (short)100); test(ht, 20000, (short)200); test(ht, 30000, (short)300); test(ht, 40000, (short)400); try { short value = ht.get(50000); Assert.fail("The value "+value+" was found at key "+ "50000, but there should not have been a value there."); } catch(NoValueException ex) { } System.out.println("Test contains method"); testContains(ht, new long[]{10000,20000,30000,40000}, "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(20000); if (ht.size() != 3) { Assert.fail("size should be 3, but it is "+ht.size()); } testContains(ht, new long[]{10000,30000,40000}, "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 long[]{}, "RemoveAll"); System.out.println("Test grow by adding 500 values"); for(int i=0;i<500;i++) { ht.put(i*100, (short)i); } for(int i= 0;i<50000;i++) { if (ht.contains(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 LongShortHashtable() { this((short)3); }
LongShortHashtable implements Serializable { public LongShortHashtable() { this((short)3); } }
LongShortHashtable implements Serializable { public LongShortHashtable() { this((short)3); } LongShortHashtable();  LongShortHashtable(int capacity); }
LongShortHashtable implements Serializable { public LongShortHashtable() { this((short)3); } LongShortHashtable();  LongShortHashtable(int capacity); void put(long key, short value); short get(long key); boolean remove(long key); void removeAll(); boolean contains(long key); int size(); long[] getKeys(); }
LongShortHashtable implements Serializable { public LongShortHashtable() { this((short)3); } LongShortHashtable();  LongShortHashtable(int capacity); void put(long key, short value); short get(long key); boolean remove(long key); void removeAll(); boolean contains(long key); int size(); long[] getKeys();  }