Class References.WeakKeyReference<K>

  • All Implemented Interfaces:
    References.InternalReference<K>
    Enclosing class:
    References

    static class References.WeakKeyReference<K>
    extends java.lang.ref.WeakReference<K>
    implements References.InternalReference<K>
    The key in a cache that holds keys weakly. This class retains the key's identity hash code in the advent that the key is reclaimed so that the entry can be removed from the cache in constant time.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int hashCode  
    • Constructor Summary

      Constructors 
      Constructor Description
      WeakKeyReference​(K key, java.lang.ref.ReferenceQueue<K> queue)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object object)  
      java.lang.Object getKeyReference()
      Returns the key that is associated to the cache entry holding this reference.
      int hashCode()  
      • 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

        private final int hashCode
    • Constructor Detail

      • WeakKeyReference

        public WeakKeyReference​(@Nullable
                                K key,
                                @Nullable
                                java.lang.ref.ReferenceQueue<K> queue)
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object object)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object