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 |
---|
AbstractReferenceMap.ReferenceEntry(AbstractReferenceMap parent,
AbstractHashedMap.HashEntry next,
int hashCode,
Object key,
Object value)
Creates a new entry object for the ReferenceMap.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Compares this map entry to another.
|
Object |
getKey()
Gets the key from the entry.
|
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.
|
Object |
setValue(Object obj)
Sets the value of the entry.
|
protected Object |
toReference(int type,
Object referent,
int hash)
Constructs a reference of the given type to the given referent.
|
toString
protected final AbstractReferenceMap parent
public AbstractReferenceMap.ReferenceEntry(AbstractReferenceMap parent, AbstractHashedMap.HashEntry next, int hashCode, Object key, Object value)
parent
- the parent mapnext
- the next entry in the hash buckethashCode
- the hash code of the keykey
- the keyvalue
- the valuepublic Object getKey()
public Object getValue()
public Object setValue(Object obj)
setValue
in interface Map.Entry
setValue
in class AbstractHashedMap.HashEntry
obj
- the object to storepublic boolean equals(Object obj)
This implementation uses isEqualKey
and
isEqualValue
on the main map for comparison.
equals
in interface Map.Entry
equals
in class AbstractHashedMap.HashEntry
obj
- the other map entry to compare topublic int hashCode()
This implementation uses hashEntry
on the main map.
hashCode
in interface Map.Entry
hashCode
in class AbstractHashedMap.HashEntry
protected Object toReference(int type, 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–2015 The Apache Software Foundation. All rights reserved.