Class WeakObject<T>

  • Direct Known Subclasses:
    WeakEntry

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

      Fields 
      Modifier and Type Field Description
      protected int hashcode
      The hash code.
    • Constructor Summary

      Constructors 
      Constructor Description
      WeakObject​(T object)
      Construct a new reference.
      WeakObject​(T obj, java.lang.ref.ReferenceQueue<? super T> queue)
      Construct a
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object object)
      Check the equality of an object with this.
      int hashCode()
      Return the hash code of the nested object.
      • Methods inherited from class java.lang.ref.Reference

        clear, clone, enqueue, get, isEnqueued, reachabilityFence
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • hashcode

        protected final int hashcode
        The hash code.
    • Constructor Detail

      • WeakObject

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

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

      • equals

        public boolean equals​(java.lang.Object object)
        Check the equality of an object with this.
        Overrides:
        equals in class java.lang.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 java.lang.Object
        Returns:
        The hash code of the nested object.