protected static class AbstractReferenceMap.ReferenceEntry<K,V> extends AbstractHashedMap.HashEntry <K ,V>
If getKey() or getValue() returns null, it means the mapping is stale and should be removed.
hashCode, key, next, value| Constructor and Description |
|---|
ReferenceEntry(AbstractReferenceMap
Creates a new entry object for the ReferenceMap.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object
Compares this map entry to another.
|
K |
getKey()
Gets the key from the entry.
|
V |
getValue()
Gets the value from the entry.
|
int |
hashCode()
Gets the hashcode of the entry using temporary hard references.
|
protected AbstractReferenceMap |
next()
Gets the next entry in the bucket.
|
V |
setValue(V obj)
Sets the value of the entry.
|
protected <T> Object |
toReference(AbstractReferenceMap
Constructs a reference of the given type to the given referent.
|
toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitcomparingByKey, comparingByKey, comparingByValue, comparingByValuepublic ReferenceEntry(AbstractReferenceMap<K ,V> parent, AbstractHashedMap .HashEntry <K ,V> next, int hashCode, K key, V value)
parent - the parent map
next - the next entry in the hash bucket
hashCode - the hash code of the key
key - the key
value - the value
public K getKey()
public V getValue()
public boolean equals(Objectobj)
This implementation uses isEqualKey and isEqualValue on the main map for comparison.
public int hashCode()
This implementation uses hashEntry on the main map.
protected <T> ObjecttoReference(AbstractReferenceMap .ReferenceStrength type, T referent, int hash)
T - the type of the referenced object
type - HARD, SOFT or WEAK
referent - the object to refer to
hash - the hash code of the
key of the mapping; this number might be different from referent.hashCode() if the referent represents a value and not a key
protected AbstractReferenceMap.ReferenceEntry <K ,V> next()