MyMap implements Map<K,V> { public V get(Object k) { int i = keys.indexOf(k); if (i == -1) return null; return values.get(i); } 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 testRetrieval() { String queryString = "O'Reilly"; System.out.println("You asked about " + queryString + "."); String resultString = (String)map.get(queryString); System.out.println("They are located in: " + resultString); assertEquals("get test", "Sebastopol, CA", resultString); }