ShortSet implements Serializable { public void removeKnownPresent(int key) { size--; final short location = locations[key]; final short replacement = data[size]; data[location] = replacement; locations[replacement] = location; } ShortSet(int capacity); void add(short key); void addAll(ShortSet that); void addKnownAbsent(short key); void clear(); boolean contains(short key); void copyDataFrom(ShortSet that); @Override boolean equals(Object obj); short get(int i); @Override int hashCode(); void remove(short key); void removeKnownPresent(int key); int size(); @Override String toString(); String toString(CoordinateSystem coords);  }
@Test public void testRemoveKnownPresent() { set.add((short)1); set.add((short)2); set.add((short)3); set.removeKnownPresent(2); assertEquals(2, set.size()); assertEquals("{1, 3}", set.toString()); }