K - Key typeV - Value typepublic abstract class AbstractSoftMap<K,V> extends AbstractMap<K,V> implements ICommonsMap<K,V>
Map implementation based on
http://www.javaspecialists.eu/archive/Issue015.htmlentrySet implementation is from
org.hypergraphdb.utilAbstractSoftMap is NOT serializable!| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractSoftMap.SoftValue<K,V>
We 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.
|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Modifier and Type | Field and Description |
|---|---|
protected Map<K,AbstractSoftMap.SoftValue<K,V>> |
m_aSrcMap
The internal HashMap that will hold the SoftReference.
|
| Constructor and Description |
|---|
AbstractSoftMap(Map<K,AbstractSoftMap.SoftValue<K,V>> aSrcMap) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
Set<Map.Entry<K,V>> |
entrySet() |
boolean |
equals(Object o) |
V |
get(Object aKey) |
int |
hashCode() |
protected void |
onEntryRemoved(K aKey)
Callback method invoked after a map entry is garbage collected
|
V |
put(K aKey,
V aValue)
Here we put the key, value pair into the HashMap using a SoftValue object.
|
V |
remove(Object aKey) |
int |
size() |
clone, containsKey, containsValue, isEmpty, keySet, putAll, toString, valuesfinalize, getClass, notify, notifyAll, wait, wait, waitaddAll, 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, setAllcompute, computeIfAbsent, computeIfPresent, containsKey, containsValue, forEach, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll, valuesgetClone@CodingStyleguideUnaware protected final Map<K,AbstractSoftMap.SoftValue<K,V>> m_aSrcMap
@OverrideOnDemand protected void onEntryRemoved(K aKey)
aKey - Key the removed keypublic V put(K aKey, V aValue)
public void clear()
public int size()
@ReturnsMutableObject(value="design") @CodingStyleguideUnaware public Set<Map.Entry<K,V>> entrySet()
public boolean equals(Object o)
Copyright © 2014–2019 Philip Helger. All rights reserved.