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.

## Nested Class Summary

## Nested classes/interfaces inherited from class java.util.AbstractMap

`AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>`

## Nested classes/interfaces inherited from interface java.util.Map

`Map.Entry<K extends Object,V extends Object>`

## Constructor Summary

Constructors
Constructor
Description
`SoftValuesHashMap()`

## Method Summary

Modifier and Type
Method
Description
`void`
`clear()`
`Set<Map.Entry<K,V>>`
`entrySet()`
`V`
`get(Object key)`
`V`
`put(K key, V value)`
Store the object.
`V`
`remove(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`

### Methods inherited from interface java.util.Map

`compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll`

## Constructor Details

### SoftValuesHashMap

public SoftValuesHashMap()

## Method Details

### 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>`