|
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 |
|---|
java.util.Map.Entry<K,V> |
| Constructor Summary | |
|---|---|
UnmodifiableMap(java.util.Map<K,V> m)
Creates a new unmodifiable map from another map. |
|
| Method Summary | |
|---|---|
void |
clear()
Operation is not supported. |
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
UnmodifiableSet<java.util.Map.Entry<K,V>> |
entrySet()
|
V |
get(java.lang.Object key)
|
boolean |
isEmpty()
|
UnmodifiableSet<K> |
keySet()
|
V |
put(K arg0,
V arg1)
Operation is not supported. |
void |
putAll(java.util.Map<? extends K,? extends V> arg0)
Operation is not supported. |
V |
remove(java.lang.Object arg0)
Operation is not supported. |
int |
size()
|
java.lang.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(java.util.Map<K,V> m)
| Method Detail |
|---|
public boolean isEmpty()
isEmpty in interface java.util.Map<K,V>public int size()
size in interface java.util.Map<K,V>public boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Map<K,V>public boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Map<K,V>public V get(java.lang.Object key)
get in interface java.util.Map<K,V>public UnmodifiableSet<K> keySet()
keySet in interface java.util.Map<K,V>public UnmodifiableCollection<V> values()
values in interface java.util.Map<K,V>public UnmodifiableSet<java.util.Map.Entry<K,V>> entrySet()
entrySet in interface java.util.Map<K,V>public void clear()
clear in interface java.util.Map<K,V>java.lang.UnsupportedOperationException
public V put(K arg0,
V arg1)
put in interface java.util.Map<K,V>java.lang.UnsupportedOperationExceptionpublic void putAll(java.util.Map<? extends K,? extends V> arg0)
putAll in interface java.util.Map<K,V>java.lang.UnsupportedOperationExceptionpublic V remove(java.lang.Object arg0)
remove in interface java.util.Map<K,V>java.lang.UnsupportedOperationExceptionpublic java.lang.String toString()
toString in class java.lang.Object
|
TUM CCSM Commons | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||