void (int index) { super.remove(index); // dispose corresponding entries only IdentityHashMap<K, V> map = new IdentityHashMap<>(); Iterator<Entry<K, V>> it = myContent.entrySet().iterator(); while (it.hasNext()) { Entry<K, V> entry = it.next(); V value = entry.getValue(); if (value != null && this != value.getParent()) { map.put(entry.getKey(), value); it.remove(); } } // avoid ConcurrentModificationException map.forEach(this::dispose); }