com.triactive.jdo.util
Class ReferenceValueMap
java.lang.Object
com.triactive.jdo.util.ReferenceValueMap
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Map
- Direct Known Subclasses:
- SoftValueMap, WeakValueMap
- public abstract class ReferenceValueMap
- extends java.lang.Object
- implements java.util.Map, java.lang.Cloneable
A java.util.Map
implementation using reference values.
The values are stored in the map as references. If the garbage collector
clears the reference, the corresponding key is automatically removed from the
map.
- Author:
- Mike Martin
- See Also:
Reference
Nested Class Summary |
static interface |
ReferenceValueMap.ValueReference
References returned by newValueReference must implement
this interface to provide the corresponding map key for the value. |
Nested classes inherited from class java.util.Map |
java.util.Map.Entry |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
ReferenceValueMap
public ReferenceValueMap()
ReferenceValueMap
public ReferenceValueMap(int initialCapacity)
ReferenceValueMap
public ReferenceValueMap(int initialCapacity,
float loadFactor)
ReferenceValueMap
public ReferenceValueMap(java.util.Map m)
clone
public java.lang.Object clone()
newValueReference
protected abstract 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.
Subclasses must implement this method to construct Reference
objects of the desired type (e.g. SoftReference
, etc.).
- 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.
put
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
- Specified by:
put
in interface java.util.Map
putAll
public void putAll(java.util.Map m)
- Specified by:
putAll
in interface java.util.Map
get
public java.lang.Object get(java.lang.Object key)
- Specified by:
get
in interface java.util.Map
clear
public void clear()
- Specified by:
clear
in interface java.util.Map
size
public int size()
- Specified by:
size
in interface java.util.Map
containsKey
public boolean containsKey(java.lang.Object obj)
- Specified by:
containsKey
in interface java.util.Map
containsValue
public boolean containsValue(java.lang.Object obj)
- Specified by:
containsValue
in interface java.util.Map
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interface java.util.Map
keySet
public java.util.Set keySet()
- Specified by:
keySet
in interface java.util.Map
values
public java.util.Collection values()
- Specified by:
values
in interface java.util.Map
entrySet
public java.util.Set entrySet()
- Specified by:
entrySet
in interface java.util.Map
remove
public java.lang.Object remove(java.lang.Object key)
- Specified by:
remove
in interface java.util.Map
hashCode
public int hashCode()
- Specified by:
hashCode
in interface java.util.Map
equals
public boolean equals(java.lang.Object o)
- Specified by:
equals
in interface java.util.Map
reap
public void reap()
Copyright © 2001 TriActive, Inc. All Rights Reserved.