com.triactive.jdo.util
Class SoftValueMap
java.lang.Object
java.util.AbstractMap
com.triactive.jdo.util.ReferenceValueMap
com.triactive.jdo.util.SoftValueMap
- All Implemented Interfaces:
- java.util.Map
- public class SoftValueMap
- extends com.triactive.jdo.util.ReferenceValueMap
A java.util.Map
implementation with soft values.
The values are stored as soft references.
If map entry value object is not actively being used, i.e. no other object
has a strong reference to it, it may become garbage collected at the
discretion of the garbage collector (typically if the VM is low on memory).
If this happens, the entry in the SoftValueMap
corresponding to
the value object will also be removed.
- Author:
- Mike Martin
- See Also:
SoftReference
Nested classes inherited from class java.util.Map |
java.util.Map.Entry |
Field Summary |
protected java.lang.ref.ReferenceQueue |
refQueue
|
Method Summary |
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
java.util.Set |
entrySet()
|
boolean |
equals(java.lang.Object o)
|
java.lang.Object |
get(java.lang.Object key)
|
int |
hashCode()
|
boolean |
isEmpty()
|
java.util.Set |
keySet()
|
protected java.lang.ref.Reference |
newReference(java.lang.Object value)
Returns a new Reference object to be inserted into the map. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
java.lang.Object |
remove(java.lang.Object key)
|
int |
size()
|
java.lang.String |
toString()
|
java.util.Collection |
values()
|
Methods inherited from class java.util.AbstractMap |
clear, clone, putAll |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
refQueue
protected final java.lang.ref.ReferenceQueue refQueue
SoftValueMap
public SoftValueMap()
SoftValueMap
public SoftValueMap(int initialCapacity)
SoftValueMap
public SoftValueMap(int initialCapacity,
float loadFactor)
SoftValueMap
public SoftValueMap(java.util.Map m)
newReference
protected java.lang.ref.Reference newReference(java.lang.Object value)
- Description copied from class:
com.triactive.jdo.util.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.).
- Parameters:
value
- The associated value to be referenced.
- Returns:
- A new
Reference
object to be inserted into the map.
put
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
get
public java.lang.Object get(java.lang.Object key)
size
public int size()
isEmpty
public boolean isEmpty()
containsKey
public boolean containsKey(java.lang.Object key)
containsValue
public boolean containsValue(java.lang.Object value)
keySet
public java.util.Set keySet()
values
public java.util.Collection values()
entrySet
public java.util.Set entrySet()
remove
public java.lang.Object remove(java.lang.Object key)
hashCode
public int hashCode()
equals
public boolean equals(java.lang.Object o)
toString
public java.lang.String toString()
Copyright © 2001-2007 The TJDO Project All Rights Reserved.