Package com.google.common.cache
Class RemovalNotification<K,V>
- java.lang.Object
-
- com.google.common.cache.RemovalNotification<K,V>
-
- All Implemented Interfaces:
java.util.Map.Entry<K,V>
@Beta @GwtCompatible public final class RemovalNotification<K,V> extends java.lang.Object implements java.util.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 withCacheBuilder
, this class holds strong references to the key and value, regardless of the type of references the cache may be using.- Since:
- 10.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object object)
RemovalCause
getCause()
Returns the cause for which the entry was removed.K
getKey()
V
getValue()
int
hashCode()
V
setValue(V value)
java.lang.String
toString()
Returns a string representation of the form{key}={value}
.boolean
wasEvicted()
Returnstrue
if there was an automatic removal due to eviction (the cause is neitherRemovalCause.EXPLICIT
norRemovalCause.REPLACED
).
-
-
-
Method Detail
-
getCause
public RemovalCause getCause()
Returns the cause for which the entry was removed.
-
wasEvicted
public boolean wasEvicted()
Returnstrue
if there was an automatic removal due to eviction (the cause is neitherRemovalCause.EXPLICIT
norRemovalCause.REPLACED
).
-
getValue
@Nullable public V getValue()
-
equals
public boolean equals(@Nullable java.lang.Object object)
-
hashCode
public int hashCode()
-
toString
public java.lang.String toString()
Returns a string representation of the form{key}={value}
.- Overrides:
toString
in classjava.lang.Object
-
-