@InternalApi public class ReferenceCountedHashMap<K,V> extends HashMap<K,V>
Specifically we have subclassed only the methods related to placement and removal. Though there is more functionality which could be used from Java8, we have chosen to not subclass them as we are not expecting their use as of now. Other items have not been subclassed as they do not affect reference counts (e.g.: get).
Modifier and Type | Class and Description |
---|---|
static interface |
ReferenceCountedHashMap.Callable<I>
Interface for destructor code.
|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
ReferenceCountedHashMap()
Constructor for ReferenceCountedHashMap.
|
ReferenceCountedHashMap(ReferenceCountedHashMap.Callable<V> cleanerCallable)
Constructor for ReferenceCountedHashMap wth a destructor callable.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Remove all items from hash map and all references from reference counter.
|
Object |
clone() |
V |
put(K key,
V value)
Put inserts a key-value pair into the map.
|
void |
putAll(Map<? extends K,? extends V> m) |
V |
remove(Object key)
Remove removes a reference to the key within the context of the reference count.
|
compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, putIfAbsent, remove, replace, replace, replaceAll, size, values
equals, hashCode, toString
public ReferenceCountedHashMap()
public ReferenceCountedHashMap(ReferenceCountedHashMap.Callable<V> cleanerCallable)
public V put(K key, V value)
public V remove(Object key)
public void clear()