public class RefCountedMap<K,V> extends Object
Constructor and Description |
---|
RefCountedMap()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear out the collection.
|
boolean |
dereference(K key)
Decreases the reference count for a given key by one.
|
V |
get(K key)
Get the value for a given key, returning null if the key was not found.
|
V |
put(K key,
V value)
Add and key and value with a reference count as one.
|
void |
reference(K key)
Increase the reference count for a given key by one.
|
public V put(K key, V value)
key
- to addvalue
- to addpublic V get(K key)
key
- is the key to look up and return the value forpublic void reference(K key)
key
- is the key to increase the ref count forpublic boolean dereference(K key)
key
- to de-referencepublic void clear()