FastByIDMap implements Serializable, Cloneable { public V remove(long key) { if (key == NULL || key == REMOVED) { return null; } int index = find(key); if (keys[index] == NULL) { return null; } else { keys[index] = REMOVED; numEntries--; V oldValue = values[index]; values[index] = null; return oldValue; } } FastByIDMap();  FastByIDMap(int size);  FastByIDMap(int size, float loadFactor);  FastByIDMap(int size, int maxSize);  FastByIDMap(int size, int maxSize, float loadFactor); V get(long key); int size(); boolean isEmpty(); boolean containsKey(long key); boolean containsValue(Object value); V put(long key, V value); V remove(long key); void clear(); LongPrimitiveIterator keySetIterator(); Set<Map.Entry<Long,V>> entrySet(); Collection<V> values(); void rehash(); @Override FastByIDMap<V> clone(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object other); static final int NO_MAX_SIZE; }
@Test public void testRemove() { FastByIDMap<Long> map = new FastByIDMap<Long>(); map.put(500000L, 2L); map.remove(500000L); assertEquals(0, map.size()); assertTrue(map.isEmpty()); assertNull(map.get(500000L)); }
@Test public void testRemove() { FastByIDMap<Long> map = new FastByIDMap<>(); map.put(500000L, 2L); map.remove(500000L); assertEquals(0, map.size()); assertTrue(map.isEmpty()); assertNull(map.get(500000L)); }