Map to ensure it can't be altered.
This class is Serializable from Commons Collections 3.1.
Attempts to modify it will result in an UnsupportedOperationException.
| Modifier and Type | Field and Description |
|---|---|
| private static final long | serialVersionUID
Serialization version |
| Access | Constructor and Description |
|---|---|
| private | UnmodifiableMap(final Map<? extends K, ? extends V>
the map to decorate, must not be null map)Constructor that wraps (not copies). |
| Modifier and Type | Method and Description |
|---|---|
| public void | clear()
Overrides org. Implements java. |
| public Set | entrySet()
Overrides org. Implements java. Set view of the mappings contained in this map.
|
| public Set | keySet()
Overrides org. Implements java. Set view of the keys contained in this map.
|
| public MapIterator | mapIterator()
Overrides org. Implements org. MapIterator over the map.
|
| public V | put(final K
key with which the specified value is to be associated key, final V value to be associated with the specified key value)Overrides org. Implements java. |
| public void | putAll(final Map<? extends K, ? extends V>
mappings to be stored in this map mapToCopy)Overrides org. Implements java. |
| private void | |
| public V | remove(final Object
key whose mapping is to be removed from the map key)Overrides org. Implements java. |
| public static < the key type K, the value type V> Map | Returns: a new unmodifiable mapthe map to decorate, must not be null map)Factory method to create an unmodifiable map. |
| public Collection | values()
Overrides org. Implements java. Collection view of the values contained in this map.
|
| private void |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Serialization version | |
| UnmodifiableMap | back to summary |
|---|---|
| private UnmodifiableMap(final Map<? extends K, ? extends V> map) Constructor that wraps (not copies).
| |
| clear | back to summary |
|---|---|
| public void clear() Overrides org. Implements java. Doc from java. Removes all of the mappings from this map (optional operation). The map will be empty after this call returns.
| |
| entrySet | back to summary |
|---|---|
| public Set Overrides org. Implements java. Doc from java. Returns a | |
| keySet | back to summary |
|---|---|
| public Set Overrides org. Implements java. Doc from java. Returns a | |
| mapIterator | back to summary |
|---|---|
| public MapIterator Overrides org. Implements org. Doc from org. Obtains a A map iterator is an efficient way of iterating over maps. There is no need to access the entry set or use Map Entry objects.
IterableMap<String,Integer> map = new HashedMap<String,Integer>();
MapIterator<String,Integer> it = map.mapIterator();
while (it.hasNext()) {
String key = it.next();
Integer value = it.getValue();
it.setValue(value + 1);
}
| |
| put | back to summary |
|---|---|
| public V put(final K key, final V value) Overrides org. Implements java. Doc from java. Associates the specified value with the specified key in this map
(optional operation). If the map previously contained a mapping for
the key, the old value is replaced by the specified value. (A map
| |
| putAll | back to summary |
|---|---|
| public void putAll(final Map<? extends K, ? extends V> mapToCopy) Overrides org. Implements java. Doc from java. Copies all of the mappings from the specified map to this map
(optional operation). The effect of this call is equivalent to that
of calling | |
| readObject | back to summary |
|---|---|
| private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException Read the map in using a custom routine.
| |
| remove | back to summary |
|---|---|
| public V remove(final Object key) Overrides org. Implements java. Doc from java. Removes the mapping for a key from this map if it is present
(optional operation). More formally, if this map contains a mapping
from key Returns the value to which this map previously associated the key,
or If this map permits null values, then a return value of
The map will not contain a mapping for the specified key once the call returns. | |
| unmodifiableMap | back to summary |
|---|---|
| public static <K, V> Map Factory method to create an unmodifiable map.
| |
| values | back to summary |
|---|---|
| public Collection Overrides org. Implements java. Doc from java. Returns a
| |
| writeObject | back to summary |
|---|---|
| private void writeObject(final ObjectOutputStream out) throws IOException Write the map out using a custom routine.
| |