public class SoftCache<K,V> extends Object
SoftReference
cache wherein the values in the hashmap are not prevented
from being garbage collected.Constructor and Description |
---|
SoftCache() |
SoftCache(int initialCapacity) |
SoftCache(int initialCapacity,
float loadFactor) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears all mappings.
|
boolean |
containsKey(K key)
Returns true if the supplied key exists in this map and is mapped to an active value.
|
V |
get(K key)
Looks up and returns the value associated with the supplied key.
|
HashMap<K,SoftReference<V>> |
getMap()
Returns a reference to the underlying map.
|
V |
put(K key,
V value)
Maps the specified key to the specified value.
|
V |
remove(K key)
Removes the specified key from the map.
|
public SoftCache(int initialCapacity, float loadFactor)
public SoftCache(int initialCapacity)
public SoftCache()
public HashMap<K,SoftReference<V>> getMap()
public boolean containsKey(K key)
public V remove(K key)
public void clear()
Copyright © 2015. All rights reserved.