Class RemovalNotification<K,​V>

  • All Implemented Interfaces:
    java.io.Serializable, java.util.Map.Entry<K,​V>

    @GwtCompatible
    public final class RemovalNotification<K,​V>
    extends java.util.AbstractMap.SimpleImmutableEntry<@Nullable K,​@Nullable V>
    A notification of the removal of a single entry. The key and/or value may be null if they were already garbage collected.

    Like other Entry instances associated with CacheBuilder, this class holds strong references to the key and value, regardless of the type of references the cache may be using.

    Since:
    10.0
    Author:
    Charles Fry
    See Also:
    Serialized Form
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <K,​V>
      RemovalNotification<K,​V>
      create​(@Nullable K key, @Nullable V value, RemovalCause cause)
      Creates a new RemovalNotification for the given key/value pair, with the given cause for the removal.
      RemovalCause getCause()
      Returns the cause for which the entry was removed.
      boolean wasEvicted()
      Returns true if there was an automatic removal due to eviction (the cause is neither RemovalCause.EXPLICIT nor RemovalCause.REPLACED).
      • Methods inherited from class java.util.AbstractMap.SimpleImmutableEntry

        equals, getKey, getValue, hashCode, setValue, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • create

        public static <K,​V> RemovalNotification<K,​V> create​(@Nullable K key,
                                                                        @Nullable V value,
                                                                        RemovalCause cause)
        Creates a new RemovalNotification for the given key/value pair, with the given cause for the removal. The key and/or value may be null if they were already garbage collected.
        Since:
        19.0