Class AbstractReferenceMap.ReferenceEntry
java.lang.Object
com.espertech.esper.common.internal.collection.apachecommons.AbstractHashedMap.HashEntry
com.espertech.esper.common.internal.collection.apachecommons.AbstractReferenceMap.ReferenceEntry
- Enclosing class:
- AbstractReferenceMap
A MapEntry implementation for the map.
If getKey() or getValue() returns null, it means the mapping is stale and should be removed.
- Since:
- Commons Collections 3.1
-
Field Summary
Fields inherited from class com.espertech.esper.common.internal.collection.apachecommons.AbstractHashedMap.HashEntry
hashCode, key, next, value
-
Constructor Summary
ConstructorDescriptionReferenceEntry
(AbstractReferenceMap parent, AbstractHashedMap.HashEntry next, int hashCode, Object key, Object value) Creates a new entry object for the ReferenceMap. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares this map entry to another.getKey()
Gets the key from the entry.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.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.Methods inherited from class com.espertech.esper.common.internal.collection.apachecommons.AbstractHashedMap.HashEntry
toString
-
Field Details
-
parent
The parent map
-
-
Constructor Details
-
ReferenceEntry
public ReferenceEntry(AbstractReferenceMap parent, AbstractHashedMap.HashEntry next, int hashCode, Object key, Object value) Creates a new entry object for the ReferenceMap.- Parameters:
parent
- the parent mapnext
- the next entry in the hash buckethashCode
- the hash code of the keykey
- the keyvalue
- the value
-
-
Method Details
-
getKey
Gets the key from the entry. This method dereferences weak and soft keys and thus may return null. -
getValue
Gets the value from the entry. This method dereferences weak and soft value and thus may return null. -
setValue
Sets the value of the entry.- Specified by:
setValue
in interfaceMap.Entry
- Overrides:
setValue
in classAbstractHashedMap.HashEntry
- Parameters:
obj
- the object to store- Returns:
- the previous value
-
equals
Compares this map entry to another.This implementation uses
isEqualKey
andisEqualValue
on the main map for comparison.- Specified by:
equals
in interfaceMap.Entry
- Overrides:
equals
in classAbstractHashedMap.HashEntry
- Parameters:
obj
- the other map entry to compare to- Returns:
- true if equal, false if not
-
hashCode
public int hashCode()Gets the hashcode of the entry using temporary hard references.This implementation uses
hashEntry
on the main map.- Specified by:
hashCode
in interfaceMap.Entry
- Overrides:
hashCode
in classAbstractHashedMap.HashEntry
- Returns:
- the hashcode of the entry
-
toReference
Constructs a reference of the given type to the given referent. The reference is registered with the queue for later purging.- Parameters:
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 key- Returns:
- reference
-
next
Gets the next entry in the bucket.- Returns:
- the next entry in the bucket
-