MyMap implements Map<K,V> { @SuppressWarnings({ "unchecked", "rawtypes" }) public Set entrySet() { if (keys.size() != values.size()) throw new IllegalStateException( "InternalError: keys and values out of sync"); ArrayList<MyMapEntry> al = new ArrayList<MyMapEntry>(); for (int i=0; i<keys.size(); i++) { al.add(new MyMapEntry(keys.get(i), values.get(i))); } return new MyMapSet<MyMapEntry>(al); } MyMap(); int size(); boolean isEmpty(); boolean containsKey(Object o); boolean containsValue(Object o); V get(Object k); @SuppressWarnings("unchecked") V put(Object k, Object v); @Override void putAll(@SuppressWarnings("rawtypes") Map oldMap); V remove(Object k); void clear(); java.util.Set<K> keySet(); java.util.Collection<V> values(); @SuppressWarnings({ "unchecked", "rawtypes" }) Set entrySet();  }
@Test public void testEntrySet() { final Set<Entry<String, String>> es = map.entrySet(); assertEquals("entrySet test", NUM_ENTRIES, es.size()); }