org.aspectbench.tm.runtime.internal
Class WeakKeyCollectingIdentityHashMap
java.lang.Object
org.aspectbench.tm.runtime.internal.IdentityHashMap
org.aspectbench.tm.runtime.internal.WeakKeyCollectingIdentityHashMap
- All Implemented Interfaces:
- java.util.Map
- public class WeakKeyCollectingIdentityHashMap
- extends IdentityHashMap
Nested classes inherited from class java.util.Map |
java.util.Map.Entry |
Method Summary |
void |
cleanup()
Perform the cleanup, i.e. |
void |
clear()
|
java.lang.Object |
get(java.lang.Object key)
|
boolean |
isEmpty()
Strictly speaking, this shoudn't be used for checking emptiness, since the
intention is for subclasses to provide weak-key maps, i.e. maps that drop
a key-value pair as soon as the (weakref) key expires. Since GC runs happen
beyond the control of the program, this might happen in between a call to
isEmpty() and the use of the map on the assumption it's non-empty.
The preferred way is creating a value iterator and using its next() method.
If that returns null, then there are no more elements.
It is, however, safe to assume that if this method returns true, then the
map will indeed be empty until more elements are added. |
protected org.aspectbench.tm.runtime.internal.IdentityHashMap.KeyIterator |
keyIterator()
Constructs a KeyIterator object |
java.util.Set |
keySet()
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
java.lang.Object |
remove(java.lang.Object key)
|
int |
size()
Return the number of key/value pairs in the map. |
Methods inherited from class org.aspectbench.tm.runtime.internal.IdentityHashMap |
calculateNewCapacity, calculateThreshold, checkCapacity, containsKey, containsValue, entrySet, hashIndex, hashIndex, hashIndexFromCode, hashIndexFromCode, putAll, rebalance, values |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Map |
equals, hashCode |
WeakKeyCollectingIdentityHashMap
public WeakKeyCollectingIdentityHashMap()
WeakKeyCollectingIdentityHashMap
public WeakKeyCollectingIdentityHashMap(int initialCapacity,
float loadFactor,
int threshold)
WeakKeyCollectingIdentityHashMap
public WeakKeyCollectingIdentityHashMap(int initialCapacity,
float loadFactor)
WeakKeyCollectingIdentityHashMap
public WeakKeyCollectingIdentityHashMap(int initialCapacity)
cleanup
public void cleanup()
- Perform the cleanup, i.e. drop all expired key/value pairs.
clear
public void clear()
-
- Specified by:
clear
in interface java.util.Map
- Overrides:
clear
in class IdentityHashMap
get
public java.lang.Object get(java.lang.Object key)
-
- Specified by:
get
in interface java.util.Map
- Overrides:
get
in class IdentityHashMap
isEmpty
public boolean isEmpty()
- Strictly speaking, this shoudn't be used for checking emptiness, since the
intention is for subclasses to provide weak-key maps, i.e. maps that drop
a key-value pair as soon as the (weakref) key expires. Since GC runs happen
beyond the control of the program, this might happen in between a call to
isEmpty() and the use of the map on the assumption it's non-empty.
The preferred way is creating a value iterator and using its next() method.
If that returns null, then there are no more elements.
It is, however, safe to assume that if this method returns true, then the
map will indeed be empty until more elements are added.
- Specified by:
isEmpty
in interface java.util.Map
- Overrides:
isEmpty
in class IdentityHashMap
keyIterator
protected org.aspectbench.tm.runtime.internal.IdentityHashMap.KeyIterator keyIterator()
- Constructs a KeyIterator object
- Overrides:
keyIterator
in class IdentityHashMap
keySet
public java.util.Set keySet()
-
- Specified by:
keySet
in interface java.util.Map
- Overrides:
keySet
in class IdentityHashMap
put
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
-
- Specified by:
put
in interface java.util.Map
- Overrides:
put
in class IdentityHashMap
remove
public java.lang.Object remove(java.lang.Object key)
-
- Specified by:
remove
in interface java.util.Map
- Overrides:
remove
in class IdentityHashMap
size
public int size()
- Return the number of key/value pairs in the map.
- Specified by:
size
in interface java.util.Map
- Overrides:
size
in class IdentityHashMap