|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jpox.util.ReferenceValueMap
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.
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 |
Constructor Summary | |
ReferenceValueMap()
Default Constructor. |
|
ReferenceValueMap(int initial_capacity)
Constructor taking initial capacity. |
|
ReferenceValueMap(int initial_capacity,
float load_factor)
Constructor taking initial capacity and load factor. |
|
ReferenceValueMap(java.util.Map m)
Constructor taking initial Map. |
Method Summary | |
void |
clear()
Method to empty the HashMap. |
java.lang.Object |
clone()
Clone method. |
boolean |
containsKey(java.lang.Object obj)
Accessor for whether the Map contains the specified Key |
boolean |
containsValue(java.lang.Object obj)
Accessor for whether the Map contains the specified value. |
java.util.Set |
entrySet()
Accessor for the entry set. |
boolean |
equals(java.lang.Object o)
Equality operator. |
java.lang.Object |
get(java.lang.Object key)
Method to get a value for a key. |
int |
hashCode()
Hashcode generator for this object. |
boolean |
isEmpty()
Accessor for whether the Map is empty. |
java.util.Set |
keySet()
Accessor for the Set of keys in the Map. |
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. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Method to add an object to the Map. |
void |
putAll(java.util.Map m)
Method to add the contents of a Map. |
void |
reap()
Utility method to reap objects. |
java.lang.Object |
remove(java.lang.Object key)
Method to remove an object for the specified key. |
int |
size()
Accessor for the size of the HashMap. |
java.util.Collection |
values()
Accessor for the values from the Map. |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ReferenceValueMap()
public ReferenceValueMap(int initial_capacity)
initial_capacity
- Initial Capacity of HashMappublic ReferenceValueMap(int initial_capacity, float load_factor)
initial_capacity
- Initial Capacity of HashMapload_factor
- Load Factor of HashMappublic ReferenceValueMap(java.util.Map m)
m
- Map to initial with.Method Detail |
public java.lang.Object clone()
protected abstract ReferenceValueMap.ValueReference newValueReference(java.lang.Object key, java.lang.Object value, java.lang.ref.ReferenceQueue queue)
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.).
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.
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface java.util.Map
key
- Key for objectvalue
- Value of object
public void putAll(java.util.Map m)
putAll
in interface java.util.Map
m
- Mappublic java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map
key
- The Key
public void clear()
clear
in interface java.util.Map
public int size()
size
in interface java.util.Map
public boolean containsKey(java.lang.Object obj)
containsKey
in interface java.util.Map
obj
- The key
public boolean containsValue(java.lang.Object obj)
containsValue
in interface java.util.Map
obj
- The value
public boolean isEmpty()
isEmpty
in interface java.util.Map
public java.util.Set keySet()
keySet
in interface java.util.Map
public java.util.Collection values()
values
in interface java.util.Map
public java.util.Set entrySet()
entrySet
in interface java.util.Map
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map
key
- The Key
public int hashCode()
hashCode
in interface java.util.Map
public boolean equals(java.lang.Object o)
equals
in interface java.util.Map
o
- THe object to compare against.
public void reap()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |