|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.artima.lookup.util.ConsistentMapEntry
final class ConsistentMapEntry
An implementation of the 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.
Field Summary | |
---|---|
private Object |
key
|
private static long |
serialVersionUID
|
private Object |
value
|
Constructor Summary | |
---|---|
ConsistentMapEntry(Object key,
Object value)
Constructs a new ConsistentMapEntry with passed
key and value . |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private Object key
private Object value
Constructor Detail |
---|
public ConsistentMapEntry(Object key, Object value)
ConsistentMapEntry
with passed
key
and value
. null
is
allowed in either (or both) parameters.
key
- the key (null
key is OK)value
- the value (null
value is OK) associated with the keyMethod Detail |
---|
public Object getKey()
getKey
in interface Map.Entry
public Object getValue()
getValue
in interface Map.Entry
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.
equals
in interface Map.Entry
equals
in class Object
o
- the object to compare against
true
if the objects are the semantically equal,
false
otherwise.private static boolean equalsOrNull(Object o1, Object o2)
public int hashCode()
ConsistentMapEntry
object.
hashCode
in interface Map.Entry
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |