com.artima.lookup.util
Class ConsistentMap

java.lang.Object
  |
  +--java.util.AbstractMap
        |
        +--com.artima.lookup.util.ConsistentMap
All Implemented Interfaces:
java.util.Map, java.io.Serializable

public class ConsistentMap
extends java.util.AbstractMap
implements java.io.Serializable

An implementation of the 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.

See Also:
Serialized Form

Inner classes inherited from class java.util.Map
java.util.Map.Entry
 
Constructor Summary
ConsistentMap()
          Constructs a new, empty ConsistentMap.
ConsistentMap(java.util.Map init)
          Constructs a new ConsistentMap containing the elements in the passed collection.
 
Method Summary
 java.util.Set entrySet()
          Returns a set view of the mappings contained in this ConsistentMap.
 
Methods inherited from class java.util.AbstractMap
clear, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConsistentMap

public ConsistentMap()
Constructs a new, empty ConsistentMap. All instances of ConsistentMap are unmodifiable.

ConsistentMap

public ConsistentMap(java.util.Map init)
Constructs a new ConsistentMap containing the elements in the passed collection. All instances of ConsistentMap are unmodifiable.
Parameters:
init - the map whose elements are to be placed into this map.
Method Detail

entrySet

public java.util.Set entrySet()
Returns a set view of the mappings contained in this ConsistentMap. Each element in the returned set is a Map.Entry
Overrides:
entrySet in class java.util.AbstractMap
Returns:
a set view of the mappings contained in this ConsistentMap.