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 type
V - the value type
All Implemented Interfaces:
Map<K,V>

public class SoftValuesHashMap<K,V> extends 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.
  • Field Details

  • Constructor Details

    • SoftValuesHashMap

      public SoftValuesHashMap()
  • Method Details

    • processQueue

      private void processQueue()
    • get

      public V get(Object key)
      Specified by:
      get in interface Map<K,V>
      Overrides:
      get in class 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 Map<K,V>
      Overrides:
      put in class AbstractMap<K,V>
      Parameters:
      key - the key
      value - the value
      Returns:
      null or the old object.
    • remove

      public V remove(Object key)
      Remove an object.
      Specified by:
      remove in interface Map<K,V>
      Overrides:
      remove in class AbstractMap<K,V>
      Parameters:
      key - the key
      Returns:
      null or the old object
    • clear

      public void clear()
      Specified by:
      clear in interface Map<K,V>
      Overrides:
      clear in class AbstractMap<K,V>
    • entrySet

      public Set<Map.Entry<K,V>> entrySet()
      Specified by:
      entrySet in interface Map<K,V>
      Specified by:
      entrySet in class AbstractMap<K,V>