edu.tum.cs.commons.collections
Class UnmodifiableSortedMap<K,V>
java.lang.Object
edu.tum.cs.commons.collections.UnmodifiableMap<K,V>
edu.tum.cs.commons.collections.UnmodifiableSortedMap<K,V>
- All Implemented Interfaces:
- Serializable, Map<K,V>, SortedMap<K,V>
public class UnmodifiableSortedMap<K,V>
- extends UnmodifiableMap<K,V>
- implements SortedMap<K,V>
This is a wrapper for a SortedMap 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.unmodifiableSortedMap(SortedMap), but by making it a
public class we can make the return value of some methods more explicit.
- Version:
- $Revision: 26283 $
- Author:
- Benjamin Hummel, $Author: juergens $
- See Also:
- Serialized Form
- Rating:
- GREEN Hash: ABDE6CF5CE63ADC67CA6BB5BB9D17737
| Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
| Methods inherited from class edu.tum.cs.commons.collections.UnmodifiableMap |
clear, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, toString, values |
| Methods inherited from interface java.util.Map |
clear, containsKey, containsValue, equals, get, hashCode, isEmpty, put, putAll, remove, size |
UnmodifiableSortedMap
public UnmodifiableSortedMap(SortedMap<K,V> m)
- Creates a new unmodifiable sorted map from another sorted map. All
modifications to the underlying map will directly be visible in this
wrapper.
comparator
public Comparator<? super K> comparator()
-
- Specified by:
comparator in interface SortedMap<K,V>
firstKey
public K firstKey()
-
- Specified by:
firstKey in interface SortedMap<K,V>
headMap
public UnmodifiableSortedMap<K,V> headMap(K toKey)
-
- Specified by:
headMap in interface SortedMap<K,V>
lastKey
public K lastKey()
-
- Specified by:
lastKey in interface SortedMap<K,V>
subMap
public UnmodifiableSortedMap<K,V> subMap(K fromKey,
K toKey)
-
- Specified by:
subMap in interface SortedMap<K,V>
tailMap
public UnmodifiableSortedMap<K,V> tailMap(K fromKey)
-
- Specified by:
tailMap in interface SortedMap<K,V>
TUM CCSM Commons - 2.7