@GwtCompatible public final class RemovalNotification<K,V> extends Object implements Map.Entry<K,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 Map.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.
| Modifier and Type | Method and Description |
|---|---|
static <K,V> RemovalNotification<K,V> |
create(K key,
V value,
RemovalCause cause)
Creates a new
RemovalNotification for the given key/value pair, with the given cause for the removal. |
boolean |
equals(Object object) |
RemovalCause |
getCause()
Returns the cause for which the entry was removed.
|
K |
getKey() |
V |
getValue() |
int |
hashCode() |
V |
setValue(V value) |
String |
toString()
Returns a string representation of the form
{key}={value}. |
boolean |
wasEvicted()
Returns
true if there was an automatic removal due to eviction (the cause is neither RemovalCause.EXPLICIT nor RemovalCause.REPLACED). |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitcomparingByKey, comparingByKey, comparingByValue, comparingByValuepublic 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.
public RemovalCause getCause()
Returns the cause for which the entry was removed.
public boolean wasEvicted()
Returns true if there was an automatic removal due to eviction (the cause is neither RemovalCause.EXPLICIT nor RemovalCause.REPLACED).
public int hashCode()