K - Key typeV - Value typepublic abstract class AbstractSoftMap<K,V> extends AbstractMap<K,V>
Map implementation based on
http://www.javaspecialists.eu/archive/Issue015.htmlentrySet implementation is from
org.hypergraphdb.util| 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() |
V |
get(Object aKey) |
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, equals, hashCode, isEmpty, keySet, putAll, toString, valuesfinalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllprotected 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()
Copyright © 2014–2015 Philip Helger. All rights reserved.