|
Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractMap com.beasys.commerce.util.SoftHashMap
@Deprecated public class SoftHashMap
A map implemented using SoftReferences to store the values.
Unlike the java.util.WeakHashMap
implementation, this does
not utilize a ReferenceQueue, therefore, the References are cleared
immediately, rather than only after a modification to the Map.
Additionally, since this uses SoftReferences by default, the Map shouldn't
be immediately cleared. Finally, this is also cloneable and
serializable.
Constructor Summary | |
---|---|
SoftHashMap()
Deprecated Constructs a new, empty SoftHashMap with the default
capacity and the default load factor, which is 0.75 . |
|
SoftHashMap(int initialCapacity)
Deprecated Constructs a new, empty SoftHashMap with the given
initial capacity and the default load factor, which is
0.75 . |
|
SoftHashMap(int initialCapacity,
float loadFactor)
Deprecated Constructs a new, empty SoftHashMap with the given
initial capacity and the given load factor. |
|
SoftHashMap(Map map)
Deprecated Constructs a new SoftHashMap from the specified Map. |
Method Summary | |
---|---|
void |
clear()
Deprecated Removes all mappings from this map. |
Object |
clone()
Deprecated Return a shallow clone of this map. |
boolean |
containsKey(Object key)
Deprecated Returns true if this map contains a mapping for the
specified key. |
boolean |
containsValue(Object value)
Deprecated Returns true if this map contains the specified value. |
protected Reference |
createReference(Object data)
Deprecated Create a Reference object containing the specified object. |
Set |
entrySet()
Deprecated Returns a Set view of the mappings in this map. |
Object |
get(Object key)
Deprecated Returns the value to which this map maps the specified key . |
boolean |
isEmpty()
Deprecated Returns true if this map contains no key-value mappings. |
Object |
put(Object key,
Object value)
Deprecated Updates this map so that the given key maps to the given
value . |
Object |
remove(Object key)
Deprecated Removes the mapping for the given key from this map, if
present. |
int |
size()
Deprecated Returns the number of key-value mappings in this map. |
Methods inherited from class java.util.AbstractMap |
---|
equals, hashCode, keySet, putAll, toString, values |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
equals, hashCode, keySet, putAll, values |
Constructor Detail |
---|
public SoftHashMap(int initialCapacity, float loadFactor)
SoftHashMap
with the given
initial capacity and the given load factor.
initialCapacity
- The initial capacity of the
SoftHashMap
loadFactor
- The load factor of the SoftHashMap
IllegalArgumentException
- If the initial capacity is less than
zero, or if the load factor is
nonpositivepublic SoftHashMap(int initialCapacity)
SoftHashMap
with the given
initial capacity and the default load factor, which is
0.75
.
initialCapacity
- The initial capacity of the
SoftHashMap
IllegalArgumentException
- If the initial capacity is less than
zeropublic SoftHashMap()
SoftHashMap
with the default
capacity and the default load factor, which is 0.75
.
public SoftHashMap(Map map)
SoftHashMap
from the specified Map.
Method Detail |
---|
public Object clone()
clone
in class AbstractMap
protected Reference createReference(Object data)
This implementation returns SoftReferences. Subclasses can override to return other Reference types.
data
- the object (can be null).
public int size()
Map
interface, the time required by this operation is
linear in the size of the map.
size
in interface Map
size
in class AbstractMap
public boolean isEmpty()
true
if this map contains no key-value mappings.
isEmpty
in interface Map
isEmpty
in class AbstractMap
public boolean containsKey(Object key)
true
if this map contains a mapping for the
specified key.
containsKey
in interface Map
containsKey
in class AbstractMap
key
- The key whose presence in this map is to be testedpublic boolean containsValue(Object value)
true
if this map contains the specified value.
containsValue
in interface Map
containsValue
in class AbstractMap
public Object get(Object key)
key
.
If this map does not contain a value for this key, then return
null
.
get
in interface Map
get
in class AbstractMap
key
- The key whose associated value, if any, is to be returnedpublic Object put(Object key, Object value)
key
maps to the given
value
. If the map previously contained a mapping for
key
then that mapping is replaced and the previous value is
returned.
put
in interface Map
put
in class AbstractMap
key
- The key that is to be mapped to the given
value
value
- The value to which the given key
is to be
mapped
null
if if there was no mapping for the keypublic Object remove(Object key)
key
from this map, if
present.
remove
in interface Map
remove
in class AbstractMap
key
- The key whose mapping is to be removed
null
if
there was no mapping for the keypublic void clear()
clear
in interface Map
clear
in class AbstractMap
public Set entrySet()
Set
view of the mappings in this map.
entrySet
in interface Map
entrySet
in class AbstractMap
|
Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |