|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.collections4.map.AbstractIterableMap<K,V>
org.apache.commons.collections4.map.AbstractMapDecorator<K,V>
org.apache.commons.collections4.map.UnmodifiableMap<K,V>
public final class UnmodifiableMap<K,V>
Decorates another 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.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Method Summary | ||
|---|---|---|
void |
clear()
|
|
Set<Map.Entry<K,V>> |
entrySet()
|
|
Set<K> |
keySet()
|
|
MapIterator<K,V> |
mapIterator()
Obtains a MapIterator over the map. |
|
V |
put(K key,
V value)
Note that the return type is Object, rather than V as in the Map interface. |
|
void |
putAll(Map<? extends K,? extends V> mapToCopy)
|
|
V |
remove(Object key)
|
|
static
|
unmodifiableMap(Map<K,V> map)
Factory method to create an unmodifiable map. |
|
Collection<V> |
values()
|
|
| Methods inherited from class org.apache.commons.collections4.map.AbstractMapDecorator |
|---|
containsKey, containsValue, decorated, equals, get, hashCode, isEmpty, size, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
containsKey, containsValue, equals, get, hashCode, isEmpty, size |
| Methods inherited from interface org.apache.commons.collections4.Get |
|---|
containsKey, containsValue, get, isEmpty, size |
| Method Detail |
|---|
public static <K,V> Map<K,V> unmodifiableMap(Map<K,V> map)
K - the key typeV - the value typemap - the map to decorate, must not be null
IllegalArgumentException - if map is nullpublic void clear()
clear in interface Map<K,V>clear in interface Put<K,V>clear in class AbstractMapDecorator<K,V>Map.clear()
public V put(K key,
V value)
Put
put in interface Map<K,V>put in interface Put<K,V>put in class AbstractMapDecorator<K,V>Map.put(Object, Object)public void putAll(Map<? extends K,? extends V> mapToCopy)
putAll in interface Map<K,V>putAll in interface Put<K,V>putAll in class AbstractMapDecorator<K,V>Map.putAll(Map)public V remove(Object key)
remove in interface Map<K,V>remove in interface Get<K,V>remove in class AbstractMapDecorator<K,V>Map.remove(Object)public MapIterator<K,V> mapIterator()
AbstractIterableMapMapIterator over the map.
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.
IterableMapmap = new HashedMap (); MapIterator it = map.mapIterator(); while (it.hasNext()) { String key = it.next(); Integer value = it.getValue(); it.setValue(value + 1); }
mapIterator in interface IterableGet<K,V>mapIterator in class AbstractIterableMap<K,V>public Set<Map.Entry<K,V>> entrySet()
entrySet in interface Map<K,V>entrySet in interface Get<K,V>entrySet in class AbstractMapDecorator<K,V>Map.entrySet()public Set<K> keySet()
keySet in interface Map<K,V>keySet in interface Get<K,V>keySet in class AbstractMapDecorator<K,V>Map.keySet()public Collection<V> values()
values in interface Map<K,V>values in interface Get<K,V>values in class AbstractMapDecorator<K,V>Map.values()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||