K - The key type.V - The value type.public class CleaningWeakReferenceMap<K,V>
extends java.util.HashMap<K,java.lang.ref.WeakReference<V>>
HashMap with WeakReference values, so that
weak references which have been cleared are periodically removed from
the map. The cleaning occurs as part of put(K, java.lang.ref.WeakReference<V>), after a specific
number (cleanInterval) of calls to put(K, java.lang.ref.WeakReference<V>).| Constructor and Description |
|---|
CleaningWeakReferenceMap()
Initializes a new
CleaningWeakReferenceMap instance with the
default clean interval. |
CleaningWeakReferenceMap(int cleanInterval)
Initializes a new
CleaningWeakReferenceMap instance with a given
clean interval. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.ref.WeakReference<V> |
put(K key,
java.lang.ref.WeakReference<V> value) |
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuespublic CleaningWeakReferenceMap()
CleaningWeakReferenceMap instance with the
default clean interval.public CleaningWeakReferenceMap(int cleanInterval)
CleaningWeakReferenceMap instance with a given
clean interval.cleanInterval - the number of calls to put(K, java.lang.ref.WeakReference<V>) after which the
map will clean itself.