KeyValue<K,V>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 | Description |
|---|---|
ReferenceEntry(AbstractReferenceMap<K,V> parent,
AbstractHashedMap.HashEntry<K,V> next,
int hashCode,
K key,
V value) |
Creates a new entry object for the ReferenceMap.
|
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
equals(java.lang.Object obj) |
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.ReferenceEntry<K,V> |
next() |
Gets the next entry in the bucket.
|
V |
setValue(V obj) |
Sets the value of the entry.
|
protected <T> java.lang.Object |
toReference(AbstractReferenceMap.ReferenceStrength type,
T referent,
int hash) |
Constructs a reference of the given type to the given referent.
|
toStringpublic ReferenceEntry(AbstractReferenceMap<K,V> parent, AbstractHashedMap.HashEntry<K,V> next, int hashCode, K key, V value)
parent - the parent mapnext - the next entry in the hash buckethashCode - the hash code of the keykey - the keyvalue - the valuepublic K getKey()
public V getValue()
public V setValue(V obj)
setValue in class AbstractHashedMap.HashEntry<K,V>obj - the object to storepublic boolean equals(java.lang.Object obj)
This implementation uses isEqualKey and
isEqualValue on the main map for comparison.
equals in class AbstractHashedMap.HashEntry<K,V>obj - the other map entry to compare topublic int hashCode()
This implementation uses hashEntry on the main map.
hashCode in class AbstractHashedMap.HashEntry<K,V>protected <T> java.lang.Object toReference(AbstractReferenceMap.ReferenceStrength type, T referent, int hash)
T - the type of the referenced objecttype - HARD, SOFT or WEAKreferent - the object to refer tohash - 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 keyprotected AbstractReferenceMap.ReferenceEntry<K,V> next()
Copyright © 2001-2019 - Apache Software Foundation