@Immutable public final class RemovalNotification<K,V> extends Object implements Map.Entry<K,V>
Constructor and Description |
---|
RemovalNotification(K key,
V value,
RemovalCause cause)
Creates an entry representing a mapping from the specified key to the specified value.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
RemovalCause |
getCause() |
K |
getKey()
Returns the key of the removed entry or null if it was garbage collected due to
Caffeine.weakKeys() eviction. |
V |
getValue()
Returns the key of the removed entry or null if it was garbage collected due to
Caffeine.weakValues() or Caffeine.softValues() eviction. |
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, wait
comparingByKey, comparingByKey, comparingByValue, comparingByValue
public RemovalNotification(@Nullable K key, @Nullable V value, @Nonnull RemovalCause cause)
key
- the key represented by this entryvalue
- the value represented by this entrycause
- the reason for which the entry was removed@Nonnull public RemovalCause getCause()
public boolean wasEvicted()
true
if there was an automatic removal due to eviction (the cause is neither
RemovalCause.EXPLICIT
nor RemovalCause.REPLACED
).@Nullable public K getKey()
Caffeine.weakKeys()
eviction.@Nullable public V getValue()
Caffeine.weakValues()
or Caffeine.softValues()
eviction.public boolean equals(Object o)
public int hashCode()