final class ConsistentMapEntry<K,V> extends Object implements Map.Entry<K,V>, Serializable
java.util.Map.Entry interface that has
a serialized form consistent in all virtual machines. ConsistentMapEntry
instances are unmodifiable. The setValue mutator method
throws UnsupportedOperationException. This class permits null
for values and keys.
Although instances of this class are unmodifiable, they are not necessarily
immutable. If a client retrieves a mutable object (either a key or value) contained in a
ConsistentMapEntry and mutates that object, the client in effect
mutates the state of the ConsistentMapEntry. In this case, the
serialized form of the ConsistentMapEntry will most likely also
have been mutated. A ConsistentMapEntry that contains only immutable
objects will maintain a consistent serialized form indefinitely. But a
ConsistentMapEntry that contains mutable objects will maintain a
consistent serialized form only so long as the mutable objects are not
mutated.
| Modifier and Type | Field and Description |
|---|---|
private K |
key |
private static long |
serialVersionUID |
private V |
value |
| Constructor and Description |
|---|
ConsistentMapEntry(K key,
V value)
Constructs a new
ConsistentMapEntry with passed
key and value. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o)
Compares the specified object (the
Object passed
in o) with this ConsistentMapEntry
object for equality. |
private static boolean |
equalsOrNull(Object o1,
Object o2) |
K |
getKey()
Returns the key.
|
V |
getValue()
Returns the value.
|
int |
hashCode()
Returns the hash code value for this
ConsistentMapEntry object. |
V |
setValue(V value)
Replaces the value corresponding to this entry with the specified value.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitcomparingByKey, comparingByKey, comparingByValue, comparingByValueprivate static final long serialVersionUID
private final K key
private final V value
public K getKey()
public V getValue()
public V setValue(V value)
UnsupportedOperationException.setValue in interface Map.Entry<K,V>UnsupportedOperationException - alwayspublic boolean equals(Object o)
Object passed
in o) with this ConsistentMapEntry
object for equality. Returns true if the specified object
is not null, if the specified object's class is
ConsistentMapEntry, if the keys of this object and
the specified object are either both null or semantically
equal, and the values of this object and the specified object are either
both null or semantically equal.Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.