protected static class AbstractReferenceMap.ReferenceEntry extends AbstractHashedMap.HashEntry
If getKey() or getValue() returns null, it means the mapping is stale and should be removed.
| Modifier and Type | Field and Description |
|---|---|
protected AbstractReferenceMap |
parent
The parent map
|
hashCode, key, next, value| Constructor and Description |
|---|
ReferenceEntry(AbstractReferenceMap parent,
AbstractHashedMap.HashEntry next,
int hashCode,
java.lang.Object key,
java.lang.Object value)
Creates a new entry object for the ReferenceMap.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj)
Compares this map entry to another.
|
java.lang.Object |
getKey()
Gets the key from the entry.
|
java.lang.Object |
getValue()
Gets the value from the entry.
|
int |
hashCode()
Gets the hashcode of the entry using temporary hard references.
|
protected AbstractReferenceMap.ReferenceEntry |
next()
Gets the next entry in the bucket.
|
java.lang.Object |
setValue(java.lang.Object obj)
Sets the value of the entry.
|
protected java.lang.Object |
toReference(int type,
java.lang.Object referent,
int hash)
Constructs a reference of the given type to the given referent.
|
toStringprotected final AbstractReferenceMap parent
public ReferenceEntry(AbstractReferenceMap parent, AbstractHashedMap.HashEntry next, int hashCode, java.lang.Object key, java.lang.Object value)
parent - the parent mapnext - the next entry in the hash buckethashCode - the hash code of the keykey - the keyvalue - the valuepublic java.lang.Object getKey()
getKey in interface java.util.Map.EntrygetKey in interface KeyValuegetKey in class AbstractHashedMap.HashEntrypublic java.lang.Object getValue()
getValue in interface java.util.Map.EntrygetValue in interface KeyValuegetValue in class AbstractHashedMap.HashEntrypublic java.lang.Object setValue(java.lang.Object obj)
setValue in interface java.util.Map.EntrysetValue in class AbstractHashedMap.HashEntryobj - the object to storepublic boolean equals(java.lang.Object obj)
This implementation uses isEqualKey and
isEqualValue on the main map for comparison.
equals in interface java.util.Map.Entryequals in class AbstractHashedMap.HashEntryobj - the other map entry to compare topublic int hashCode()
This implementation uses hashEntry on the main map.
hashCode in interface java.util.Map.EntryhashCode in class AbstractHashedMap.HashEntryprotected java.lang.Object toReference(int type,
java.lang.Object referent,
int hash)
type - 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 next()
Copyright © 2001-2025 Apache Software Foundation. All Rights Reserved.