|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsbrt.kernel.utilities.UnmodifiableMap<K,V>
K
- the key type.V
- the value type.public class UnmodifiableMap<K,V>
This class is used to create an unmodifiable view of maps. It
is intended to mimic the behavior of
java.util.Collections.unmodifiableMap(Map)
,
but in a more explicit way. If a method returns an
UnmodifiableMap
, it's clear that the map is
unmodifiable and that UnsupportedOperationException
will be thrown
if modification is attempted.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Constructor Summary | |
---|---|
UnmodifiableMap(java.util.Map<? extends K,? extends V> m)
Constructs a new unmodifiable view of the provided map. |
Method Summary | |
---|---|
void |
clear()
See Map.clear(). |
boolean |
containsKey(java.lang.Object key)
See Map.containsKey(Object). |
boolean |
containsValue(java.lang.Object value)
See Map.containsValue(Object). |
UnmodifiableSet<java.util.Map.Entry<K,V>> |
entrySet()
See Map.entrySet(). |
boolean |
equals(java.lang.Object obj)
See Map.equals(Object). |
V |
get(java.lang.Object key)
See Map.get(Object). |
int |
hashCode()
See Map.hashCode(). |
boolean |
isEmpty()
See Map.isEmpty(). |
UnmodifiableSet<K> |
keySet()
See Map.keySet(). |
V |
put(K key,
V value)
See Map.put(Object, Object). |
void |
putAll(java.util.Map<? extends K,? extends V> t)
See Map.putAll(Map). |
V |
remove(java.lang.Object key)
See Map.remove(Object). |
int |
size()
See Map.size(). |
java.lang.String |
toString()
Returns toString() on the underlying map. |
UnmodifiableCollection<V> |
values()
See Map.values(). |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public UnmodifiableMap(java.util.Map<? extends K,? extends V> m)
m
- the map for which an unmodifiable view is created.Method Detail |
---|
public void clear()
clear
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 UnmodifiableSet<java.util.Map.Entry<K,V>> entrySet()
entrySet
in interface java.util.Map<K,V>
public V get(java.lang.Object key)
get
in interface java.util.Map<K,V>
public boolean isEmpty()
isEmpty
in interface java.util.Map<K,V>
public UnmodifiableSet<K> keySet()
keySet
in interface java.util.Map<K,V>
public V put(K key, V value)
put
in interface java.util.Map<K,V>
public void putAll(java.util.Map<? extends K,? extends V> t)
putAll
in interface java.util.Map<K,V>
public V remove(java.lang.Object key)
remove
in interface java.util.Map<K,V>
public int size()
size
in interface java.util.Map<K,V>
public UnmodifiableCollection<V> values()
values
in interface java.util.Map<K,V>
public java.lang.String toString()
toString()
on the underlying map.
toString
in class java.lang.Object
toString()
on the underlying map.public boolean equals(java.lang.Object obj)
equals
in interface java.util.Map<K,V>
equals
in class java.lang.Object
public int hashCode()
hashCode
in interface java.util.Map<K,V>
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |