serp.util
Class SoftKeyMap
java.lang.Object
|
+--serp.util.RefKeyMap
|
+--serp.util.SoftKeyMap
- All Implemented Interfaces:
- Map, RefMap
Deprecated. Replaced by the ReferenceMap
.
- public class SoftKeyMap
- extends RefKeyMap
Map implementation in which the keys are held as soft references.
Expired values are removed from the map before any mutator methods;
removing before accessor methods can lead to
ConcurrentModificationException
s. Thus, the following methods may
produce results which include key/value pairs that have expired:
size
isEmpty
containsKey
keySet.size,contains,isEmpty
entrySet.size,contains,isEmpty
values.size,contains,isEmpty
By default, all methods are delegated to the internal map provided at
construction. Thus, the ordering, etc of the given map will be preserved;
however, the hashing algorithm cannot be duplicated. A special case is
made for the IdentityMap
's hashing, which is supported.
Performance is similar to that of the internal map instance.
Constructor Summary |
SoftKeyMap()
Deprecated. Equivalent to SoftKeyMap (new HashMap ()) . |
SoftKeyMap(Map map)
Deprecated. Construct a SoftKeyMap with the given interal map. |
Methods inherited from class serp.util.RefKeyMap |
clear, containsKey, containsValue, entrySet, equals, get, isEmpty, keySet, makeHard, makeReference, put, putAll, remove, size, toString, values |
Methods inherited from interface java.util.Map |
hashCode |
SoftKeyMap
public SoftKeyMap()
- Deprecated.
- Equivalent to
SoftKeyMap (new HashMap ())
.
SoftKeyMap
public SoftKeyMap(Map map)
- Deprecated.
- Construct a SoftKeyMap with the given interal map. The internal
map will be cleared. It should not be accessed in any way after being
given to this constructor; this Map will 'inherit' its behavior,
however. For example, if the given map is a
LinkedHashMap
,
the values
method of this map will return values in
insertion order.
createRefMapKey
protected RefKeyMap.RefMapKey createRefMapKey(Object key,
ReferenceQueue queue,
boolean identity)
- Deprecated.
- Description copied from class:
RefKeyMap
- Create a weak or soft reference to hold the given key. In general,
the returned reference should guarantee that its
Object.equals(java.lang.Object)
,
Object.hashCode()
and Comparable.compareTo(java.lang.Object)
methods will
be delegated to the given key value.
- Overrides:
createRefMapKey
in class RefKeyMap
- Following copied from class:
serp.util.RefKeyMap
- Parameters:
key
- the key value to hold; will not be nullqueue
- the reference queue to place the reference in, or
null if the reference should not be placed in
a queueidentity
- if true, the Object.equals(java.lang.Object)
and
Object.hashCode()
methods of the returned
reference should work by the JVM identity of the
key, not its corresponding methods
Copyright 2001,2002,2003 SolarMetric, Inc. All Rights Reserved.