FastMap implements Map<K,V>, Serializable, Cloneable { @Override public Set<Entry<K,V>> entrySet() { return new EntrySet(); } FastMap();  FastMap(int size);  FastMap(Map<K,V> other);  FastMap(int size, float loadFactor);  FastMap(int size, int maxSize);  FastMap(int size, int maxSize, float loadFactor); @Override V get(Object key); @Override int size(); @Override boolean isEmpty(); @Override boolean containsKey(Object key); @Override boolean containsValue(Object value); @Override V put(K key, V value); @Override void putAll(Map<? extends K,? extends V> map); @Override V remove(Object key); @Override void clear(); @Override Set<K> keySet(); @Override Collection<V> values(); @Override Set<Entry<K,V>> entrySet(); void rehash(); @Override FastMap<K,V> clone(); @Override int hashCode(); @Override boolean equals(Object other); @Override String toString(); static final int NO_MAX_SIZE; }
@Test public void testEntrySet() { FastMap<String, String> map = buildTestFastMap(); Set<Map.Entry<String, String>> actual = map.entrySet(); Collection<String> expectedKeys = Sets.newHashSetWithExpectedSize(3); expectedKeys.add("foo"); expectedKeys.add("baz"); expectedKeys.add("alpha"); Collection<String> expectedValues = Sets.newHashSetWithExpectedSize(3); expectedValues.add("bar"); expectedValues.add("bang"); expectedValues.add("beta"); assertEquals(3, actual.size()); for (Map.Entry<String, String> entry : actual) { expectedKeys.remove(entry.getKey()); expectedValues.remove(entry.getValue()); } assertEquals(0, expectedKeys.size()); assertEquals(0, expectedValues.size()); }