Package org.jivesoftware.smack.util
Class CleaningWeakReferenceMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,WeakReference<V>>
org.jivesoftware.smack.util.CleaningWeakReferenceMap<K,V>
- Type Parameters:
K
- The key type.V
- The value type.
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<K,
WeakReference<V>>
Extends a
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>)
.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
ConstructorDescriptionInitializes a newCleaningWeakReferenceMap
instance with the default clean interval.CleaningWeakReferenceMap
(int cleanInterval) Initializes a newCleaningWeakReferenceMap
instance with a given clean interval. -
Method Summary
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Constructor Details
-
CleaningWeakReferenceMap
public CleaningWeakReferenceMap()Initializes a newCleaningWeakReferenceMap
instance with the default clean interval. -
CleaningWeakReferenceMap
Initializes a newCleaningWeakReferenceMap
instance with a given clean interval.- Parameters:
cleanInterval
- the number of calls toput(K, java.lang.ref.WeakReference<V>)
after which the map will clean itself.
-
-
Method Details