final class ConsistentMapEntry extends Object implements Map.Entry, 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 Object |
key |
private static long |
serialVersionUID |
private Object |
value |
Constructor and Description |
---|
ConsistentMapEntry(Object key,
Object 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) |
Object |
getKey()
Returns the key.
|
Object |
getValue()
Returns the value.
|
int |
hashCode()
Returns the hash code value for this
ConsistentMapEntry object. |
Object |
setValue(Object value)
Replaces the value corresponding to this entry with the specified value.
|
private static final long serialVersionUID
private Object key
private Object value
public Object getKey()
public Object getValue()
public Object setValue(Object value)
UnsupportedOperationException
.setValue
in interface Map.Entry
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.