Class SoftHashMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.pushingpixels.radiance.theming.internal.utils.SoftHashMap<K,V>
- All Implemented Interfaces:
Serializable
,Map<K,
V>
The original implementation is taken from The Java
Specialists' Newsletter [Issue 098] with permission of the original
author. Tweaked code by Endre Stolsvik was
contributed in December 2009.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map
<K, SoftHashMap.KeySoftReference<K, V>> The internal HashMap that will hold the SoftReference.private final ReferenceQueue
<V> Reference queue for cleared SoftReference objects. -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.AbstractMap
clone, containsValue, equals, hashCode, isEmpty, keySet, putAll, toString, values
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
hash
The internal HashMap that will hold the SoftReference. -
queue
Reference queue for cleared SoftReference objects.
-
-
Constructor Details
-
SoftHashMap
SoftHashMap()
-
-
Method Details
-
get
-
expungeStaleEntries
private void expungeStaleEntries() -
put
-
remove
-
clear
public void clear() -
size
public int size() -
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V> - Overrides:
containsKey
in classAbstractMap<K,
V>
-
entrySet
Returns a copy of the key/values in the map at the point of calling. However, setValue still sets the value in the actual SoftHashMap.
-