org.jscience.util.cache
Class WeakValueHashMap

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

public class WeakValueHashMap
extends java.util.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

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
WeakValueHashMap()
          Creates a new WeakValueHashMap object.
 
Method Summary
 boolean containsKey(java.lang.Object o)
          DOCUMENT ME!
 java.util.Set entrySet()
          DOCUMENT ME!
 java.lang.Object get(java.lang.Object key)
          DOCUMENT ME!
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          DOCUMENT ME!
 
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()
Creates a new WeakValueHashMap object.

Method Detail

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
DOCUMENT ME!

Specified by:
put in interface java.util.Map
Overrides:
put in class java.util.AbstractMap
Parameters:
key - DOCUMENT ME!
value - DOCUMENT ME!
Returns:
DOCUMENT ME!

get

public java.lang.Object get(java.lang.Object key)
DOCUMENT ME!

Specified by:
get in interface java.util.Map
Overrides:
get in class java.util.AbstractMap
Parameters:
key - DOCUMENT ME!
Returns:
DOCUMENT ME!

containsKey

public boolean containsKey(java.lang.Object o)
DOCUMENT ME!

Specified by:
containsKey in interface java.util.Map
Overrides:
containsKey in class java.util.AbstractMap
Parameters:
o - DOCUMENT ME!
Returns:
DOCUMENT ME!

entrySet

public java.util.Set entrySet()
DOCUMENT ME!

Specified by:
entrySet in interface java.util.Map
Specified by:
entrySet in class java.util.AbstractMap
Returns:
DOCUMENT ME!