Class AbstractSoftMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
com.helger.commons.collection.map.AbstractSoftMap<K,V>
- Type Parameters:
K- Key typeV- Value type
- All Implemented Interfaces:
ICommonsMap<K,,V> ICloneable<ICommonsMap<K,,V>> Map<K,V>
- Direct Known Subclasses:
SoftHashMap,SoftLinkedHashMap
Soft
The
Note:
Map implementation based on
http://www.javaspecialists.eu/archive/Issue015.htmlThe
entrySet implementation is from
org.hypergraphdb.utilNote:
AbstractSoftMap is NOT serializable!- Author:
- Philip Helger
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final classWe define our own subclass of SoftReference which contains not only the value but also the key to make it easier to find the entry in the HashMap after it's been garbage collected.Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractSoftMap(Map<K, AbstractSoftMap.SoftValue<K, V>> aSrcMap) -
Method Summary
Methods inherited from class java.util.AbstractMap
clone, containsKey, containsValue, isEmpty, keySet, putAll, toString, valuesMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.commons.lang.ICloneable
getCloneMethods inherited from interface com.helger.commons.collection.impl.ICommonsMap
addAll, containsAnyEntry, containsAnyKey, containsAnyValue, copyOfEntrySet, copyOfKeySet, copyOfKeySet, copyOfValues, copyOfValues, copyOfValuesMapped, copyOfValuesMapped, createInstance, findFirstEntry, findFirstKey, findFirstValue, forEach, forEachKey, forEachKey, forEachValue, forEachValue, getAsUnmodifiable, getFirstEntry, getFirstEntry, getFirstKey, getFirstKey, getFirstValue, getFirstValue, getSortedByKey, getSortedByValue, getSwappedKeyValues, isNotEmpty, put, putAll, putAll, putAllMapped, putAllMapped, putAllMapped, putIf, putIfNotNull, removeAll, removeIf, removeIfKey, removeIfValue, removeObject, setAllMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, forEach, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll, values
-
Field Details
-
m_aSrcMap
The internal HashMap that will hold the SoftReference.
-
-
Constructor Details
-
AbstractSoftMap
-
-
Method Details
-
onEntryRemoved
Callback method invoked after a map entry is garbage collected- Parameters:
aKey- Key the removed key
-
get
-
put
Here we put the key, value pair into the HashMap using a SoftValue object. -
remove
-
clear
public void clear() -
size
public int size() -
entrySet
-
equals
-
hashCode
public int hashCode()
-