### Question:
LRUMap implements Map<K, V> { @Override public Set<K> keySet() { return new AbstractSet<K>() { @Override public Iterator<K> iterator() { return new KeyIterator(); } @Override public int size() { return map.size(); } @Override public boolean contains(Object o) { return containsKey(o); } @Override public boolean remove(Object o) { return LRUMap.this.remove(o) != null; } @Override public void clear() { LRUMap.this.clear(); } }; } LRUMap(int cacheSize); @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 V remove(Object key); @Override void putAll(Map<? extends K, ? extends V> m); @Override void clear(); @Override Set<K> keySet(); @Override Collection<V> values(); @Override Set<Map.Entry<K, V>> entrySet(); @Override String toString();  }### Answer:
@Test public void testKeySetIterator() { Iterator<String> iterator = map.keySet().iterator(); assertTrue(iterator.hasNext()); assertEquals("key3", iterator.next()); assertEquals("key2", iterator.next()); assertEquals("key1", iterator.next()); assertTrue(!iterator.hasNext()); }