|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Object | +--org.apache.commons.collections.SoftRefHashMap
HashMap with SoftReference links to values which allows the values of the Map
to be garbage collected by the JVM if it becomes low on memory.
Derive from this class and
override the factory method createReference() method to make
a Map wrapped in other types of Reference.
A synchronized version can be obtained with:
Collections.synchronizedMap( theMapToSynchronize )
WARNING the values() and entrySet() methods require optimisation
like the standard HashMap implementations so that iteration
over this Map is efficient.
| Inner classes inherited from class java.util.Map |
Map.Entry |
| Constructor Summary | |
SoftRefHashMap()
|
|
| Method Summary | |
void |
clear()
Clears all mappings |
boolean |
containsKey(Object key)
Answers whether the argument is in the domain of the mappings |
boolean |
containsValue(Object value)
Answers whether the argument is a Referenced value |
protected Reference |
createReference(Object referent)
Returns a reference to the argument. |
Set |
entrySet()
Returns a set view of the mappings in the wrapped map |
boolean |
equals(Object object)
Answers whether this map and the argument are 'the same' |
Object |
get(Object key)
Retrieves the referent of the Referenced value |
protected Map |
getMap()
Retrieves the wrapped HashMap |
int |
hashCode()
Calculates the hash code for this map |
boolean |
isEmpty()
Answers whether there are any mappings |
Set |
keySet()
Returns the domain of the mappings |
void |
purge()
Removes References that have had their referents garbage collected |
Object |
put(Object key,
Object value)
Adds a key-value mapping, wrapping the value in a Reference |
void |
putAll(Map map)
Put all of the mappings in the argument into this wrapped map |
Object |
remove(Object key)
Removes a mapping from this map |
int |
size()
Returns the number of mappings in this map |
Collection |
values()
Returns a collection of the Referenced values |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SoftRefHashMap()
| Method Detail |
public void clear()
clear in interface Mappublic boolean containsKey(Object key)
containsKey in interface Mappublic boolean containsValue(Object value)
containsValue in interface Mapprotected Reference createReference(Object referent)
public Set entrySet()
entrySet in interface Mappublic boolean equals(Object object)
equals in interface Mapequals in class Objectpublic Object get(Object key)
get in interface Mapkey - The key with which to retrieve the valueprotected Map getMap()
public int hashCode()
hashCode in interface MaphashCode in class Objectpublic boolean isEmpty()
isEmpty in interface Mappublic Set keySet()
keySet in interface Mappublic void purge()
public Object put(Object key,
Object value)
put in interface Mappublic void putAll(Map map)
putAll in interface Mappublic Object remove(Object key)
remove in interface Mappublic int size()
size in interface Mappublic Collection values()
values in interface Map
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||