Ableverse™
Platform 6.0

av.util
Class SoftValueMap<K,V>

java.lang.Object
  extended by av.util.RefValueMap<K,V>
      extended by av.util.SoftValueMap<K,V>
All Implemented Interfaces:
Serializable, Cloneable, Iterable<V>

public class SoftValueMap<K,V>
extends RefValueMap<K,V>

This is the soft reference version of mem sensitive maps those do not prevent the values from being garbage collected.
As WeakHashMap is implemented with weak keys, it will not prevent the key from being discarded by the garbage collector. A WeakHashMap is useful in many cases but it doesn't cover the case that keys are constants like ( i.e. primitives and interned strings ), while the values should be garbage collectable while no strong references to them were held anymore. In these particular cases using a WeakHashMap is either unexpectable or has no advantage at all -- Boxed up primitives may be too soon discarded while interned strings are almost never garbage collected. This class and other subclasses of RefValueMap are here to fill this vacancy.

Author:
Compl
See Also:
RefValueMap, WeakValueMap, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class av.util.RefValueMap
RefValueMap.Itr
 
Constructor Summary
SoftValueMap()
           
SoftValueMap(int initialCapacity)
           
SoftValueMap(int initialCapacity, float loadFactor)
           
 
Method Summary
protected  SoftReference<V> createReference(V v)
           
 
Methods inherited from class av.util.RefValueMap
clear, clone, containsKey, equals, get, hashCode, iterator, keySet, put, putAll, remove
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SoftValueMap

public SoftValueMap()

SoftValueMap

public SoftValueMap(int initialCapacity,
                    float loadFactor)

SoftValueMap

public SoftValueMap(int initialCapacity)
Method Detail

createReference

protected SoftReference<V> createReference(V v)
Specified by:
createReference in class RefValueMap<K,V>

Ableverse™
Platform 6.0

Copyright© 2006 Ableverse Platform. All rights reserved.