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

    Modifier and Type
    Method
    Description
    get()
    Returns this reference object's referent.
    Returns the key that is associated to the cache entry holding this reference.
    default boolean
    Returns true if the arguments is an References.InternalReference that holds the same element.
  • Method Details

    • 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 returns null.
      Returns:
      The object to which this reference refers, or null if this reference object has been cleared
    • getKeyReference

      @Nonnull 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 the References.WeakKeyReference is returned.
      Returns:
      the key that is associated to the cached entry
    • referenceEquals

      default boolean referenceEquals(@Nullable Object object)
      Returns true 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