boolean (Object o) { if (!(o instanceof Map.Entry)) return false; //noinspection unchecked Map.Entry<K,V> e = (Map.Entry<K,V>)o; V ev = e.getValue(); HardKey<K> key = createHardKey(e.getKey()); boolean toRemove; try { V hv = myMap.get(key); toRemove = hv == null ? ev == null && myMap.containsKey(key) : hv.equals(ev); if (toRemove) { myMap.remove(key); } } finally { key.clear(); } processQueue(); return toRemove; }