com.triactive.jdo.util
Class WeakValueMap

java.lang.Object
  extended bycom.triactive.jdo.util.ReferenceValueMap
      extended bycom.triactive.jdo.util.WeakValueMap
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map

public class WeakValueMap
extends ReferenceValueMap

A java.util.Map implementation using weak reference values.

The values are stored in the map as weak references. If the garbage collector clears the reference, the corresponding key is automatically removed from the map.

Author:
Mike Martin
See Also:
WeakReference

Nested Class Summary
 
Nested classes inherited from class com.triactive.jdo.util.ReferenceValueMap
ReferenceValueMap.ValueReference
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Constructor Summary
WeakValueMap()
           
WeakValueMap(int initialCapacity)
           
WeakValueMap(int initialCapacity, float loadFactor)
           
WeakValueMap(java.util.Map m)
           
 
Method Summary
protected  ReferenceValueMap.ValueReference newValueReference(java.lang.Object key, java.lang.Object value, java.lang.ref.ReferenceQueue queue)
          Returns a new Reference object to be inserted into the map.
 
Methods inherited from class com.triactive.jdo.util.ReferenceValueMap
clear, clone, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, reap, remove, size, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WeakValueMap

public WeakValueMap()

WeakValueMap

public WeakValueMap(int initialCapacity)

WeakValueMap

public WeakValueMap(int initialCapacity,
                    float loadFactor)

WeakValueMap

public WeakValueMap(java.util.Map m)
Method Detail

newValueReference

protected ReferenceValueMap.ValueReference newValueReference(java.lang.Object key,
                                                             java.lang.Object value,
                                                             java.lang.ref.ReferenceQueue queue)
Description copied from class: ReferenceValueMap
Returns a new Reference object to be inserted into the map. Subclasses must implement this method to construct Reference objects of the desired type (e.g. SoftReference, etc.).

Specified by:
newValueReference in class ReferenceValueMap
Parameters:
key - The key that will be inserted.
value - The associated value to be referenced.
queue - The ReferenceQueue with which to register the new Reference object.


Copyright ? 2001 TriActive, Inc. All Rights Reserved.