public class ConsistentMap extends AbstractMap implements Serializable
java.util.Map
interface that has
a serialized form consistent in all virtual machines. ConsistentMap
instances are unmodifiable. All mutator methods, such as add
and
remove
, throw UnsupportedOperationException
.
This class permits null
values and the null
key.
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
ConsistentMap
and mutates that object, the client in effect
mutates the state of the ConsistentMap
. In this case, the
serialized form of the ConsistentMap
will most likely also
have been mutated. A ConsistentMap
that contains only immutable
objects will maintain a consistent serialized form indefinitely. But a
ConsistentMap
that contains mutable objects will maintain a
consistent serialized form only so long as the mutable objects are not
mutated.
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Modifier and Type | Field and Description |
---|---|
private Set |
entrySet |
private static long |
serialVersionUID |
Constructor and Description |
---|
ConsistentMap()
Constructs a new, empty
ConsistentMap . |
ConsistentMap(Map init)
Constructs a new
ConsistentMap containing the elements
in the passed collection. |
Modifier and Type | Method and Description |
---|---|
Set |
entrySet()
Returns a set view of the mappings contained in this
ConsistentMap . |
private static final long serialVersionUID
private Set entrySet
public ConsistentMap()
ConsistentMap
. All instances
of ConsistentMap
are unmodifiable.public ConsistentMap(Map init)
ConsistentMap
containing the elements
in the passed collection. All instances of ConsistentMap
are unmodifiable.init
- the map whose elements are to be placed into this map.NullPointerException
- if the passed init
reference
is null
public Set entrySet()
ConsistentMap
. Each element in the returned
set is a Map.Entry
entrySet
in interface Map
entrySet
in class AbstractMap
ConsistentMap
.Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.