Interface References.InternalReference<E>
-
- All Known Implementing Classes:
References.LookupKeyReference
,References.SoftValueReference
,References.WeakKeyReference
,References.WeakValueReference
- Enclosing class:
- References
static interface References.InternalReference<E>
A weak or soft reference that includes the entry's key reference.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description E
get()
Returns this reference object's referent.java.lang.Object
getKeyReference()
Returns the key that is associated to the cache entry holding this reference.default boolean
referenceEquals(java.lang.Object object)
Returnstrue
if the arguments is an References.InternalReference that holds the same element.
-
-
-
Method Detail
-
get
@CheckForNull E get()
Returns this reference object's referent. If this reference object has been cleared, either by the program or by the garbage collector, then this method returnsnull
.- Returns:
- The object to which this reference refers, or
null
if this reference object has been cleared
-
getKeyReference
@Nonnull java.lang.Object getKeyReference()
Returns the key that is associated to the cache entry holding this reference. If the cache holds keys strongly, this is that key instance. Otherwise the cache holds keys weakly and theReferences.WeakKeyReference
is returned.- Returns:
- the key that is associated to the cached entry
-
referenceEquals
default boolean referenceEquals(@Nullable java.lang.Object object)
Returnstrue
if the arguments is an References.InternalReference that holds the same element. A weakly or softly held element is compared using identity equality.- Parameters:
object
- the reference object with which to compare- Returns:
true
if this object is the same as the argument;false
otherwise
-
-