@Test public void testRemove() throws Exception { fillMap(10); assertEquals(10, map.size()); for (int i = 0; i < 10; i++) { assertEquals("The previous value was wrong.", Integer.valueOf(i), map.remove(i)); assertNull("The previous value was wrong.", map.remove(i)); assertEquals("The size was wrong.", 10 - (i + 1), map.size()); } }
@Override public V remove(Object key) { checkNotNull(key, "Key can not be null."); V removed = get(key); items.remove(serializer.encode(key)); return removed; }
PersistentMap implements Map<K, V> { @Override public V remove(Object key) { checkNotNull(key, "Key can not be null."); V removed = get(key); items.remove(serializer.encode(key)); return removed; } }
PersistentMap implements Map<K, V> { @Override public V remove(Object key) { checkNotNull(key, "Key can not be null."); V removed = get(key); items.remove(serializer.encode(key)); return removed; } PersistentMap(Serializer serializer, DB database, String name); }
PersistentMap implements Map<K, V> { @Override public V remove(Object key) { checkNotNull(key, "Key can not be null."); V removed = get(key); items.remove(serializer.encode(key)); return removed; } PersistentMap(Serializer serializer, DB database, String name); void readInto(Map<K, V> items); @Override V remove(Object key); @Override int size(); @Override boolean isEmpty(); @Override boolean containsKey(Object key); @Override boolean containsValue(Object value); @Override V get(Object key); @Override V put(K key, V value); @Override void putAll(Map<? extends K, ? extends V> m); @Override void clear(); @Override Set<K> keySet(); @Override Collection<V> values(); @Override Set<Entry<K, V>> entrySet(); @Override boolean equals(Object map); @Override int hashCode(); }
PersistentMap implements Map<K, V> { @Override public V remove(Object key) { checkNotNull(key, "Key can not be null."); V removed = get(key); items.remove(serializer.encode(key)); return removed; } PersistentMap(Serializer serializer, DB database, String name); void readInto(Map<K, V> items); @Override V remove(Object key); @Override int size(); @Override boolean isEmpty(); @Override boolean containsKey(Object key); @Override boolean containsValue(Object value); @Override V get(Object key); @Override V put(K key, V value); @Override void putAll(Map<? extends K, ? extends V> m); @Override void clear(); @Override Set<K> keySet(); @Override Collection<V> values(); @Override Set<Entry<K, V>> entrySet(); @Override boolean equals(Object map); @Override int hashCode();  }