|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.webmacro.util.SimpleIdentityMap
Identity map, that is especially suited to canonical mappings.
This map is identical to SimpleMap, except two special featurs.
1. Two keys are compared for equality only by reference. There
equals() and hashCode() method are not called. Instead a special
system hash function is used, that is based upon the reference.
This leads to a superior performance to hash-functions used for
strings for example.
2. Keys are only held via a WeakReference. This means, that if
the key object is not referenced at another place, it will be
removed from this map. This makes sense, as you cannot access
the value mapped to this key anymore, since you do not have
a reference to the key anymore.
Constructor Summary | |
SimpleIdentityMap()
Create a new SimpleMap with 1001 LRU buckets |
|
SimpleIdentityMap(int size)
Create a new SimpleMap with 'size' LRU buckets |
Method Summary | |
void |
clear()
|
java.lang.Object |
get(java.lang.Object key)
Get the value of 'key' back. |
void |
put(java.lang.Object key,
java.lang.Object value)
Add a key to the SimpleMap. |
java.lang.Object |
remove(java.lang.Object key)
Ensure that the key does not appear in the map Remember that you have to use the identical object (same reference) as the key, that was used when you placed the object into the map. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SimpleIdentityMap()
public SimpleIdentityMap(int size)
Method Detail |
public void put(java.lang.Object key, java.lang.Object value)
put
in interface SimpleMap
public java.lang.Object get(java.lang.Object key)
get
in interface SimpleMap
public java.lang.Object remove(java.lang.Object key)
remove
in interface SimpleMap
public void clear()
clear
in interface SimpleMap
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |