Class SoftHashMap<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- org.pushingpixels.radiance.theming.internal.utils.SoftHashMap<K,V>
-
- All Implemented Interfaces:
java.io.Serializable,java.util.Map<K,V>
class SoftHashMap<K,V> extends java.util.AbstractMap<K,V> implements java.io.SerializableThe 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 Classes Modifier and Type Class Description static classSoftHashMap.KeySoftReference<K,V>
-
Constructor Summary
Constructors Constructor Description SoftHashMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()booleancontainsKey(java.lang.Object key)java.util.Set<java.util.Map.Entry<K,V>>entrySet()Returns a copy of the key/values in the map at the point of calling.private voidexpungeStaleEntries()Vget(java.lang.Object key)Vput(K key, V value)Vremove(java.lang.Object key)intsize()-
Methods inherited from class java.util.AbstractMap
clone, containsValue, equals, hashCode, isEmpty, keySet, putAll, toString, values
-
-
-
-
Field Detail
-
hash
private final java.util.Map<K,SoftHashMap.KeySoftReference<K,V>> hash
The internal HashMap that will hold the SoftReference.
-
queue
private final java.lang.ref.ReferenceQueue<V> queue
Reference queue for cleared SoftReference objects.
-
-
Method Detail
-
get
public V get(java.lang.Object key)
-
expungeStaleEntries
private void expungeStaleEntries()
-
remove
public V remove(java.lang.Object key)
-
clear
public void clear()
-
size
public int size()
-
containsKey
public boolean containsKey(java.lang.Object key)
-
-