public class ConsistentMap<K,V> extends AbstractMap<K,V> 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>
Constructor and Description |
---|
ConsistentMap()
Constructs a new, empty
ConsistentMap . |
ConsistentMap(AtomicSerial.GetArg arg) |
ConsistentMap(Map<K,V> init)
Constructs a new
ConsistentMap containing the elements
in the passed collection. |
Modifier and Type | Method and Description |
---|---|
Set<Map.Entry<K,V>> |
entrySet()
Returns a set view of the mappings contained in this
ConsistentMap . |
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public ConsistentMap()
ConsistentMap
. All instances
of ConsistentMap
are unmodifiable.public ConsistentMap(Map<K,V> 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 ConsistentMap(AtomicSerial.GetArg arg) throws IOException
IOException
Copyright © 2016–2018. All rights reserved.