org.apache.commons.collections.map
Class AbstractReferenceMap.ReferenceEntry
- AbstractReferenceMap
- Map.Entry, KeyValue
protected static class AbstractReferenceMap.ReferenceEntry
A MapEntry implementation for the map.
If getKey() or getValue() returns null, it means
the mapping is stale and should be removed.
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.
|
ReferenceEntry
public ReferenceEntry(AbstractReferenceMap parent,
AbstractHashedMap.HashEntry next,
int hashCode,
Object key,
Object value)
Creates a new entry object for the ReferenceMap.
parent
- the parent mapnext
- the next entry in the hash buckethashCode
- the hash code of the keykey
- the keyvalue
- the value
equals
public boolean equals(Object obj)
Compares this map entry to another.
This implementation uses
isEqualKey
and
isEqualValue
on the main map for comparison.
- equals in interface AbstractHashedMap.HashEntry
obj
- the other map entry to compare to
- true if equal, false if not
getKey
public Object getKey()
Gets the key from the entry.
This method dereferences weak and soft keys and thus may return null.
- getKey in interface KeyValue
- getKey in interface AbstractHashedMap.HashEntry
- the key, which may be null if it was garbage collected
getValue
public Object getValue()
Gets the value from the entry.
This method dereferences weak and soft value and thus may return null.
- getValue in interface KeyValue
- getValue in interface AbstractHashedMap.HashEntry
- the value, which may be null if it was garbage collected
hashCode
public int hashCode()
Gets the hashcode of the entry using temporary hard references.
This implementation uses
hashEntry
on the main map.
- hashCode in interface AbstractHashedMap.HashEntry
- the hashcode of the entry
toReference
protected Object toReference(int type,
Object referent,
int hash)
Constructs a reference of the given type to the given referent.
The reference is registered with the queue for later purging.
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
Copyright © 2001-2006 Apache Software Foundation. All Rights Reserved.