@Test public void testKeySet() { FastMap<String, String> map = buildTestFastMap(); Collection<String> expected = Sets.newHashSetWithExpectedSize(3); expected.add("foo"); expected.add("baz"); expected.add("alpha"); Set<String> actual = map.keySet(); assertTrue(expected.containsAll(actual)); assertTrue(actual.containsAll(expected)); Iterator<String> it = actual.iterator(); while (it.hasNext()) { String value = it.next(); if (!"baz".equals(value)) { it.remove(); } } assertTrue(map.containsKey("baz")); assertFalse(map.containsKey("foo")); assertFalse(map.containsKey("alpha")); }
@Override public Set<K> keySet() { return new KeySet(); }
FastMap implements Map<K,V>, Serializable, Cloneable { @Override public Set<K> keySet() { return new KeySet(); } }
FastMap implements Map<K,V>, Serializable, Cloneable { @Override public Set<K> keySet() { return new KeySet(); } 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); }
FastMap implements Map<K,V>, Serializable, Cloneable { @Override public Set<K> keySet() { return new KeySet(); } 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(); }
FastMap implements Map<K,V>, Serializable, Cloneable { @Override public Set<K> keySet() { return new KeySet(); } 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; }