org.biojava.utils.cache
Class WeakValueHashMap

java.lang.Object
  extended by java.util.AbstractMap
      extended by org.biojava.utils.cache.WeakValueHashMap
All Implemented Interfaces:
Map

public class WeakValueHashMap
extends AbstractMap

Map implementation which keeps weak references to values. Entries are removed from the map when their value is no longer reachable using normal (hard) references. This is useful for maintaining canonical copies of objects without forcing these objects to remain in memory forever.

Note that this is distinct from the standard library class, WeakHashMap which has weak keys.

Since:
1.3
Author:
Thomas Down

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry
 
Constructor Summary
WeakValueHashMap()
           
 
Method Summary
 boolean containsKey(Object o)
           
 Set entrySet()
           
 Object get(Object key)
           
 Object put(Object key, Object value)
           
 
Methods inherited from class java.util.AbstractMap
clear, clone, containsValue, equals, hashCode, isEmpty, keySet, putAll, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WeakValueHashMap

public WeakValueHashMap()
Method Detail

put

public Object put(Object key,
                  Object value)
Specified by:
put in interface Map
Overrides:
put in class AbstractMap

get

public Object get(Object key)
Specified by:
get in interface Map
Overrides:
get in class AbstractMap

containsKey

public boolean containsKey(Object o)
Specified by:
containsKey in interface Map
Overrides:
containsKey in class AbstractMap

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map
Specified by:
entrySet in class AbstractMap