@Test public void testEntrySet() throws Exception { fillMap(10); Set<Map.Entry<Integer, Integer>> entries = map.entrySet(); for (int i = 0; i < 10; i++) { assertTrue("The key set doesn't contain all keys 0-9", entries.contains(Maps.immutableEntry(i, i))); } assertEquals("The key set has an incorrect number of entries", 10, entries.size()); }
@Override public Set<Entry<K, V>> entrySet() { Set<Entry<K, V>> entries = Sets.newHashSet(); items.entrySet(). forEach(e -> entries.add(Maps.immutableEntry(serializer.decode(e.getKey()), serializer.decode(e.getValue())))); return entries; }
PersistentMap implements Map<K, V> { @Override public Set<Entry<K, V>> entrySet() { Set<Entry<K, V>> entries = Sets.newHashSet(); items.entrySet(). forEach(e -> entries.add(Maps.immutableEntry(serializer.decode(e.getKey()), serializer.decode(e.getValue())))); return entries; } }
PersistentMap implements Map<K, V> { @Override public Set<Entry<K, V>> entrySet() { Set<Entry<K, V>> entries = Sets.newHashSet(); items.entrySet(). forEach(e -> entries.add(Maps.immutableEntry(serializer.decode(e.getKey()), serializer.decode(e.getValue())))); return entries; } PersistentMap(Serializer serializer, DB database, String name); }
PersistentMap implements Map<K, V> { @Override public Set<Entry<K, V>> entrySet() { Set<Entry<K, V>> entries = Sets.newHashSet(); items.entrySet(). forEach(e -> entries.add(Maps.immutableEntry(serializer.decode(e.getKey()), serializer.decode(e.getValue())))); return entries; } 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 Set<Entry<K, V>> entrySet() { Set<Entry<K, V>> entries = Sets.newHashSet(); items.entrySet(). forEach(e -> entries.add(Maps.immutableEntry(serializer.decode(e.getKey()), serializer.decode(e.getValue())))); return entries; } 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();  }