Keel 2.1RC2

org.apache.commons.collections
Class SoftRefHashMap

java.lang.Object
  extended byorg.apache.commons.collections.SoftRefHashMap
All Implemented Interfaces:
java.util.Map

Deprecated. This class is all kinds of wonky; use ReferenceMap instead.

public class SoftRefHashMap
extends java.lang.Object
implements java.util.Map

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.

Since:
1.0
Author:
James.Dodd,
See Also:

Nested Class Summary
(package private)  class SoftRefHashMap.Entry
          Deprecated. A map entry, which is backed by this RefHashMap
 
Field Summary
private  java.util.Map hashMap
          Deprecated. The wrapped HashMap
 
Constructor Summary
SoftRefHashMap()
          Deprecated.  
 
Method Summary
 void clear()
          Deprecated. Clears all mappings
 boolean containsKey(java.lang.Object key)
          Deprecated. Answers whether the argument is in the domain of the mappings
 boolean containsValue(java.lang.Object value)
          Deprecated. Answers whether the argument is a Referenced value
protected  java.lang.ref.Reference createReference(java.lang.Object referent)
          Deprecated. Returns a reference to the argument.
 java.util.Set entrySet()
          Deprecated. Returns a set view of the mappings in the wrapped map
 boolean equals(java.lang.Object object)
          Deprecated. Answers whether this map and the argument are 'the same'
 java.lang.Object get(java.lang.Object key)
          Deprecated. Retrieves the referent of the Referenced value
protected  java.util.Map getMap()
          Deprecated. Retrieves the wrapped HashMap
 int hashCode()
          Deprecated. Calculates the hash code for this map
 boolean isEmpty()
          Deprecated. Answers whether there are any mappings
 java.util.Set keySet()
          Deprecated. Returns the domain of the mappings
 void purge()
          Deprecated. Removes References that have had their referents garbage collected
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Deprecated. Adds a key-value mapping, wrapping the value in a Reference
 void putAll(java.util.Map map)
          Deprecated. Put all of the mappings in the argument into this wrapped map
 java.lang.Object remove(java.lang.Object key)
          Deprecated. Removes a mapping from this map
 int size()
          Deprecated. Returns the number of mappings in this map
 java.util.Collection values()
          Deprecated. Returns a collection of the Referenced values
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hashMap

private java.util.Map hashMap
Deprecated. 
The wrapped HashMap

Constructor Detail

SoftRefHashMap

public SoftRefHashMap()
Deprecated. 
Method Detail

purge

public void purge()
Deprecated. 
Removes References that have had their referents garbage collected


get

public java.lang.Object get(java.lang.Object key)
Deprecated. 
Retrieves the referent of the Referenced value

Specified by:
get in interface java.util.Map
Parameters:
key - The key with which to retrieve the value

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Deprecated. 
Adds a key-value mapping, wrapping the value in a Reference

Specified by:
put in interface java.util.Map

values

public java.util.Collection values()
Deprecated. 
Returns a collection of the Referenced values

Specified by:
values in interface java.util.Map

containsKey

public boolean containsKey(java.lang.Object key)
Deprecated. 
Answers whether the argument is in the domain of the mappings

Specified by:
containsKey in interface java.util.Map

containsValue

public boolean containsValue(java.lang.Object value)
Deprecated. 
Answers whether the argument is a Referenced value

Specified by:
containsValue in interface java.util.Map

putAll

public void putAll(java.util.Map map)
Deprecated. 
Put all of the mappings in the argument into this wrapped map

Specified by:
putAll in interface java.util.Map

entrySet

public java.util.Set entrySet()
Deprecated. 
Returns a set view of the mappings in the wrapped map

Specified by:
entrySet in interface java.util.Map

remove

public java.lang.Object remove(java.lang.Object key)
Deprecated. 
Removes a mapping from this map

Specified by:
remove in interface java.util.Map

clear

public void clear()
Deprecated. 
Clears all mappings

Specified by:
clear in interface java.util.Map

hashCode

public int hashCode()
Deprecated. 
Calculates the hash code for this map

Specified by:
hashCode in interface java.util.Map

keySet

public java.util.Set keySet()
Deprecated. 
Returns the domain of the mappings

Specified by:
keySet in interface java.util.Map

isEmpty

public boolean isEmpty()
Deprecated. 
Answers whether there are any mappings

Specified by:
isEmpty in interface java.util.Map

equals

public boolean equals(java.lang.Object object)
Deprecated. 
Answers whether this map and the argument are 'the same'

Specified by:
equals in interface java.util.Map

size

public int size()
Deprecated. 
Returns the number of mappings in this map

Specified by:
size in interface java.util.Map

createReference

protected java.lang.ref.Reference createReference(java.lang.Object referent)
Deprecated. 
Returns a reference to the argument. Override this method to make wrapped maps for other Reference types


getMap

protected java.util.Map getMap()
Deprecated. 
Retrieves the wrapped HashMap

Returns:
The wrapped HashMap

Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.