Class WeakObject<T>

Direct Known Subclasses:
WeakEntry

public class WeakObject<T> extends WeakReference<T>
Weakreference has the disadvantage that it does not support transparent equals() and hashcode() methods. WeakObject provides this support.
  • Field Details

    • hashcode

      protected final int hashcode
      The hash code.
  • Constructor Details

    • WeakObject

      public WeakObject(T object)
      Construct a new reference.
      Parameters:
      object - Object to reference.
    • WeakObject

      public WeakObject(T obj, ReferenceQueue<? super T> queue)
      Construct a WeakObject.
      Parameters:
      obj - Object to reference.
      queue - Reference queue.
  • Method Details

    • equals

      public boolean equals(Object object)
      Check the equality of an object with this.
      Overrides:
      equals in class Object
      Parameters:
      object - Object to test equality with.
      Returns:
      True if object is equal.
    • hashCode

      public int hashCode()
      Return the hash code of the nested object.
      Overrides:
      hashCode in class Object
      Returns:
      The hash code of the nested object.