|
TUM CCSM Commons | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.tum.cs.commons.collections.UnmodifiableMap<K,V>
public class UnmodifiableMap<K,V>
This is a wrapper for a Map prohibiting all calls which would modify
its contents. As the construction of this class is performed in constant time
it is prefered over copying the map (which takes linear time). Using this
class is also preferred to using the unmodifiableX() in class
Collections as they return the collection base type that does not
signal, that the object ist unmodifiable. Using the classes in this package
makes unmodifiability more explicit.
All prohibited methods throw an UnsupportedOperationException. The
class is nearly the same as the one returned by
Collections.unmodifiableMap(Map), but by making it a public class we
can make the return value of some methods more explicit.
This map is serializable if the wrapped map is serializable.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Constructor Summary | |
|---|---|
UnmodifiableMap(Map<K,V> m)
Creates a new unmodifiable map from another map. |
|
| Method Summary | |
|---|---|
void |
clear()
Operation is not supported. |
boolean |
containsKey(Object key)
|
boolean |
containsValue(Object value)
|
UnmodifiableSet<Map.Entry<K,V>> |
entrySet()
|
V |
get(Object key)
|
boolean |
isEmpty()
|
UnmodifiableSet<K> |
keySet()
|
V |
put(K arg0,
V arg1)
Operation is not supported. |
void |
putAll(Map<? extends K,? extends V> arg0)
Operation is not supported. |
V |
remove(Object arg0)
Operation is not supported. |
int |
size()
|
String |
toString()
Returns a string representation of this map. |
UnmodifiableCollection<V> |
values()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public UnmodifiableMap(Map<K,V> m)
| Method Detail |
|---|
public boolean isEmpty()
isEmpty in interface Map<K,V>public int size()
size in interface Map<K,V>public boolean containsKey(Object key)
containsKey in interface Map<K,V>public boolean containsValue(Object value)
containsValue in interface Map<K,V>public V get(Object key)
get in interface Map<K,V>public UnmodifiableSet<K> keySet()
keySet in interface Map<K,V>public UnmodifiableCollection<V> values()
values in interface Map<K,V>public UnmodifiableSet<Map.Entry<K,V>> entrySet()
entrySet in interface Map<K,V>public void clear()
clear in interface Map<K,V>UnsupportedOperationException
public V put(K arg0,
V arg1)
put in interface Map<K,V>UnsupportedOperationExceptionpublic void putAll(Map<? extends K,? extends V> arg0)
putAll in interface Map<K,V>UnsupportedOperationExceptionpublic V remove(Object arg0)
remove in interface Map<K,V>UnsupportedOperationExceptionpublic String toString()
toString in class Object
|
TUM CCSM Commons | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||