WeakIdentityHashMap is a hash map that hashes
objects based on System.identityHashMap, and holds weakly onto the
key. This fails if values make reference to the keys!
| Modifier and Type | Class and Description |
|---|---|
| pack-priv class | |
| pack-priv class |
| Modifier and Type | Field and Description |
|---|---|
| private static final float | |
| private static final Object | |
| private final ReferenceQueue | |
| private int | range
the current range for table. |
| private float | |
| private WeakIdentityHashMap. | table
the hash index |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | clear()
Implements java. Removes all of the mappings from this map (optional operation). |
| private void | |
| public boolean | containsKey(Object
key whose presence in this map is to be tested key)Overrides org. Implements java. return the element with the given key |
| private boolean | |
| protected Iterator | |
| private void | |
| public Object | get(Object
the key whose associated value is to be returned key)Implements java. return the element with the given key |
| private Object | |
| private void | |
| private int | |
| public boolean | isEmpty()
Overrides org. Implements java. Returns |
| protected final boolean | |
| protected final int | |
| private Object | |
| public Object | put(Object
key with which the specified value is to be associated key, Object value to be associated with the specified key value)Implements java. Associates the specified value with the specified key in this map (optional operation). |
| private Object | |
| public Object | remove(Object
key whose mapping is to be removed from the map key)Implements java. Removes the mapping for a key from this map if it is present (optional operation). |
| public Object | |
| private void | |
| public int | size()
Overrides org. Implements java. Returns the number of key-value mappings in this map. |
| private static Object | |
| protected void |
| DEFAULT_RATIO | back to summary |
|---|---|
| private static final float DEFAULT_RATIO | |
| NULL_KEY | back to summary |
|---|---|
| private static final Object NULL_KEY | |
| queue | back to summary |
|---|---|
| private final ReferenceQueue<T> queue | |
| range | back to summary |
|---|---|
| private int range the current range for table. | |
| ratio | back to summary |
|---|---|
| private float ratio | |
| table | back to summary |
|---|---|
| private WeakIdentityHashMap. the hash index | |
| WeakIdentityHashMap | back to summary |
|---|---|
| public WeakIdentityHashMap() the default and only constructor | |
| WeakIdentityHashMap | back to summary |
|---|---|
| public WeakIdentityHashMap(int size) | |
| clear | back to summary |
|---|---|
| public void clear() Implements java. Doc from java. Removes all of the mappings from this map (optional operation). The map will be empty after this call returns. | |
| clear | back to summary |
|---|---|
| private void clear(int size) | |
| containsKey | back to summary |
|---|---|
| public boolean containsKey(Object key) Overrides org. Implements java. return the element with the given key
| |
| containsKey | back to summary |
|---|---|
| private boolean containsKey(int hash, Object masked_key) | |
| entryIterator | back to summary |
|---|---|
| protected Iterator Implements abstract org. | |
| expunge | back to summary |
|---|---|
| private void expunge() | |
| get | back to summary |
|---|---|
| public Object get(Object key) Implements java. return the element with the given key
| |
| get | back to summary |
|---|---|
| private Object get(int hash, Object masked_key) | |
| grow | back to summary |
|---|---|
| private void grow() | |
| index | back to summary |
|---|---|
| private int index(int hash) translate hash code bucket to index | |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Overrides org. Implements java. Doc from java. Returns
| |
| keyEquals | back to summary |
|---|---|
| protected final boolean keyEquals(Object key1, Object key2) Overrides org.
| |
| keyHash | back to summary |
|---|---|
| protected final int keyHash(Object key) Overrides org.
| |
| maskKey | back to summary |
|---|---|
| private Object maskKey(Object key) | |
| put | back to summary |
|---|---|
| public Object put(Object key, Object value) Implements java. Doc from java. Associates the specified value with the specified key in this map
(optional operation). If the map previously contained a mapping for
the key, the old value is replaced by the specified value. (A map
| |
| put | back to summary |
|---|---|
| private Object put(int hash, Object masked_key, Object value) | |
| remove | back to summary |
|---|---|
| public Object remove(Object key) Implements java. Doc from java. Removes the mapping for a key from this map if it is present
(optional operation). More formally, if this map contains a mapping
from key Returns the value to which this map previously associated the key,
or If this map permits null values, then a return value of
The map will not contain a mapping for the specified key once the call returns. | |
| remove | back to summary |
|---|---|
| public Object remove(int hash, Object key) | |
| removeEntry | back to summary |
|---|---|
| private void removeEntry(WeakIdentityHashMap. | |
| size | back to summary |
|---|---|
| public int size() Overrides org. Implements java. Doc from java. Returns the number of key-value mappings in this map. If the
map contains more than
| |
| unmaskKey | back to summary |
|---|---|
| private static Object unmaskKey(Object key) | |
| valueRemoved | back to summary |
|---|---|
| protected void valueRemoved(Object value) | |
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| private WeakIdentityHashMap. | |
| private Object |
| Access | Constructor and Description |
|---|---|
| pack-priv | Entry(int key_hash, Object masked_key, Object value, WeakIdentityHashMap.
|
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
object to be compared for equality with this map entry other)Overrides java. Implements java. Compares the specified object with this entry for equality. |
| public Object | |
| pack-priv Object | |
| public Object | |
| public int | hashCode()
Overrides java. Implements java. Returns the hash code value for this map entry. |
| pack-priv boolean | |
| public Object | setValue(Object
new value to be stored in this entry value)Implements java. Replaces the value corresponding to this entry with the specified value (optional operation). |
| key_hash | back to summary |
|---|---|
| private final int key_hash | |
| next | back to summary |
|---|---|
| private WeakIdentityHashMap. Hides java. | |
| value | back to summary |
|---|---|
| private Object value | |
| Entry | back to summary |
|---|---|
| pack-priv Entry(int key_hash, Object masked_key, Object value, WeakIdentityHashMap. | |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Implements java. Doc from java. Compares the specified object with this entry for equality.
Returns
(e1.getKey()==null ?
e2.getKey()==null : e1.getKey().equals(e2.getKey())) &&
(e1.getValue()==null ?
e2.getValue()==null : e1.getValue().equals(e2.getValue()))
This ensures that the equals method works properly across
different implementations of the Map.Entry interface.
| |
| getKey | back to summary |
|---|---|
| public Object getKey() Implements java. Doc from java. Returns the key corresponding to this entry.
| |
| getMaskedKey | back to summary |
|---|---|
| pack-priv Object getMaskedKey() | |
| getValue | back to summary |
|---|---|
| public Object getValue() Implements java. Doc from java. Returns the value corresponding to this entry. If the mapping
has been removed from the backing map (by the iterator's
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Implements java. Doc from java. Returns the hash code value for this map entry. The hash code
of a map entry
(e.getKey()==null ? 0 : e.getKey().hashCode()) ^
(e.getValue()==null ? 0 : e.getValue().hashCode())
This ensures that e1.equals(e2) implies that
e1.hashCode()==e2.hashCode() for any two Entries
e1 and e2, as required by the general
contract of Object.hashCode.
| |
| sameKey | back to summary |
|---|---|
| pack-priv boolean sameKey(int hash, Object masked_key) | |
| setValue | back to summary |
|---|---|
| public Object setValue(Object value) Implements java. Doc from java. Replaces the value corresponding to this entry with the specified
value (optional operation). (Writes through to the map.) The
behavior of this call is undefined if the mapping has already been
removed from the map (by the iterator's | |
| Modifier and Type | Field and Description |
|---|---|
| private WeakIdentityHashMap. | |
| private int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| private void | |
| public Object | |
| public void | remove()
Overrides default java. Removes from the underlying collection the last element returned by this iterator (optional operation). |
| entry | back to summary |
|---|---|
| private WeakIdentityHashMap. | |
| idx | back to summary |
|---|---|
| private int idx | |
| EntryIterator | back to summary |
|---|---|
| pack-priv EntryIterator() | |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. Doc from java. Returns
| |
| locateNext | back to summary |
|---|---|
| private void locateNext() | |
| next | back to summary |
|---|---|
| public Object next() Implements java. Doc from java. Returns the next element in the iteration.
| |
| remove | back to summary |
|---|---|
| public void remove() Overrides default java. Doc from java. Removes from the underlying collection the last element returned
by this iterator (optional operation). This method can be called
only once per call to The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.
The behavior of an iterator is unspecified if this method is called
after a call to the | |