Package org.biojava.utils.io
Class SoftHashMap
java.lang.Object
java.util.AbstractMap
org.biojava.utils.io.SoftHashMap
- All Implemented Interfaces:
Map
A in memory cache using soft references. (can be garbage collected)
This code is based on: http://java-interview-faqs.blogspot.com/2008/09/building-faster-and-efficient-cache.html
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.AbstractMap
clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, 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
-
DEBUG
- See Also:
-
DEFAULT_LIMIT
- See Also:
-
-
Constructor Details
-
SoftHashMap
public SoftHashMap() -
SoftHashMap
-
-
Method Details
-
get
- Specified by:
get
in interfaceMap
- Overrides:
get
in classAbstractMap
-
put
Here we put the key, value pair into the HashMap using a SoftValue object.- Specified by:
put
in interfaceMap
- Overrides:
put
in classAbstractMap
-
remove
- Specified by:
remove
in interfaceMap
- Overrides:
remove
in classAbstractMap
-
clear
- Specified by:
clear
in interfaceMap
- Overrides:
clear
in classAbstractMap
-
size
- Specified by:
size
in interfaceMap
- Overrides:
size
in classAbstractMap
-
entrySet
- Specified by:
entrySet
in interfaceMap
- Specified by:
entrySet
in classAbstractMap
-