Class Cache.Weak

java.lang.Object
java.lang.ref.Reference<V>
java.lang.ref.WeakReference<V>
org.apache.sis.util.collection.Cache.Weak
All Implemented Interfaces:
Disposable
Enclosing class:
Cache<K,V>

private final class Cache.Weak extends WeakReference<V> implements Disposable
A weak reference which removes itself from the cache when the reference is garbage-collected.
  • Field Details

    • key

      private final K key
      The key of the referenced value.
  • Constructor Details

    • Weak

      Weak(K key, V value)
      Creates a references to be stored in the cache under the given key.
  • Method Details

    • dispose

      public void dispose()
      Removes the reference from the map.
      Specified by:
      dispose in interface Disposable