void (Map<Object, Object> map) { Object key = new Object(){ @Override public int hashCode() { fail("must not be called"); return super.hashCode(); } }; map.put(key, "ab"); assertSame("ab", map.get(key)); map.remove(key); assertTrue(map.isEmpty()); }