Package org.h2.util
Class SoftValuesHashMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.h2.util.SoftValuesHashMap<K,V>
- Type Parameters:
K
- the key typeV
- the value type
- All Implemented Interfaces:
Map<K,
V>
Map which stores items using SoftReference. Items can be garbage collected
and removed. It is not a general purpose cache, as it doesn't implement some
methods, and others not according to the map definition, to improve speed.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
A soft reference that has a hard reference to the key.Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map
<K, SoftValuesHashMap.SoftValue<V>> private final ReferenceQueue
<V> -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.AbstractMap
clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, size, 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
-
map
-
queue
-
-
Constructor Details
-
SoftValuesHashMap
public SoftValuesHashMap()
-
-
Method Details
-
processQueue
private void processQueue() -
get
-
put
Store the object. The return value of this method is null or a SoftReference. -
remove
Remove an object. -
clear
public void clear() -
entrySet
-