@Test public void testShortIntHashtable() { ShortIntHashtable ht = new ShortIntHashtable(); System.out.println("Test put method"); ht.put((short)100, 100); ht.put((short)200, 200); ht.put((short)300, 300); ht.put((short)400, 400); test(ht, (short)100, 100); test(ht, (short)200, 200); test(ht, (short)300, 300); test(ht, (short)400, 400); try { int value = ht.get((short)500); 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 short[]{100,200,300,400}, "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((short)200); if (ht.size() != 3) { Assert.fail("size should be 3, but it is "+ht.size()); } testContains(ht, new short[]{100,300,400}, "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 short[]{}, "RemoveAll"); System.out.println("Test grow by adding 500 values"); for(int i=0;i<5000;i++) { ht.put((short)(i*10), i); } for(int i= 0;i<5000;i++) { if (ht.contains((short)i)) { if (i%10 != 0) { Assert.fail("hashtable contains key "+i+", but it shouldn't"); } } else { if (i%10 == 0) { Assert.fail("hashtable should contain key "+i+", but it doesn't"); } } } }
public ShortIntHashtable() { this((short)3); }
ShortIntHashtable implements Serializable { public ShortIntHashtable() { this((short)3); } }
ShortIntHashtable implements Serializable { public ShortIntHashtable() { this((short)3); } ShortIntHashtable();  ShortIntHashtable(short capacity); }
ShortIntHashtable implements Serializable { public ShortIntHashtable() { this((short)3); } ShortIntHashtable();  ShortIntHashtable(short capacity); void put(short key, int value); int get(short key); boolean remove(short key); void removeAll(); boolean contains(short key); int size(); short[] getKeys(); }
ShortIntHashtable implements Serializable { public ShortIntHashtable() { this((short)3); } ShortIntHashtable();  ShortIntHashtable(short capacity); void put(short key, int value); int get(short key); boolean remove(short key); void removeAll(); boolean contains(short key); int size(); short[] getKeys();  }