org.h2.util
Class SoftHashMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.h2.util.SoftHashMap<K,V>
- Type Parameters:
K - the key typeV - the value type
- All Implemented Interfaces:
- java.util.Map<K,V>
public class SoftHashMap<K,V>
- extends java.util.AbstractMap<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 classes/interfaces inherited from interface java.util.Map |
java.util.Map.Entry<K,V> |
|
Method Summary |
void |
clear()
|
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
|
V |
get(java.lang.Object key)
|
V |
put(K key,
V value)
Store the object. |
V |
remove(java.lang.Object key)
Remove an object. |
| 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 |
SoftHashMap
public SoftHashMap()
get
public V get(java.lang.Object key)
- Specified by:
get in interface java.util.Map<K,V>- Overrides:
get in class java.util.AbstractMap<K,V>
put
public V put(K key,
V value)
- Store the object. The return value of this method is null or a SoftReference.
- Specified by:
put in interface java.util.Map<K,V>- Overrides:
put in class java.util.AbstractMap<K,V>
- Parameters:
key - the keyvalue - the value
- Returns:
- null or the old object.
remove
public V remove(java.lang.Object key)
- Remove an object.
- Specified by:
remove in interface java.util.Map<K,V>- Overrides:
remove in class java.util.AbstractMap<K,V>
- Parameters:
key - the key
- Returns:
- null or the old object
clear
public void clear()
- Specified by:
clear in interface java.util.Map<K,V>- Overrides:
clear in class java.util.AbstractMap<K,V>
entrySet
public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
- Specified by:
entrySet in interface java.util.Map<K,V>- Specified by:
entrySet in class java.util.AbstractMap<K,V>