K
- the type of the keys in the mapV
- the type of the values in the mappublic abstract class AbstractSortedMapDecorator<K,V> extends AbstractMapDecorator<K,V> implements IterableSortedMap<K,V>
Methods are forwarded directly to the decorated map.
This implementation does not perform any special processing with the map views. Instead it simply returns the set/collection from the wrapped map. This may be undesirable, for example if you are trying to write a validating implementation it would provide a loophole around the validation. But, you might want that loophole, so this class is kept simple.
Constructor and Description |
---|
AbstractSortedMapDecorator(java.util.SortedMap<K,V> map)
Constructor that wraps (not copies).
|
Modifier and Type | Method and Description |
---|---|
java.util.Comparator<? super K> |
comparator() |
K |
firstKey()
Gets the first key currently in this map.
|
java.util.SortedMap<K,V> |
headMap(K toKey) |
K |
lastKey()
Gets the last key currently in this map.
|
OrderedMapIterator<K,V> |
mapIterator()
Obtains a
MapIterator over the map. |
K |
nextKey(K key)
Gets the next key after the one specified.
|
K |
previousKey(K key)
Gets the previous key before the one specified.
|
java.util.SortedMap<K,V> |
subMap(K fromKey,
K toKey) |
java.util.SortedMap<K,V> |
tailMap(K fromKey) |
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
containsKey, containsValue, entrySet, get, isEmpty, keySet, remove, size, values
public java.util.Comparator<? super K> comparator()
public K firstKey()
OrderedMap
public K lastKey()
OrderedMap
public K previousKey(K key)
OrderedMap
previousKey
in interface OrderedMap<K,V>
key
- the key to search for previous frompublic K nextKey(K key)
OrderedMap
nextKey
in interface OrderedMap<K,V>
key
- the key to search for next frompublic OrderedMapIterator<K,V> mapIterator()
MapIterator
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 interface OrderedMap<K,V>
mapIterator
in class AbstractIterableMap<K,V>
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"