K - the type of the keys in this mapV - the type of the values in this mappublic abstract class AbstractOrderedMapDecorator<K,V> extends AbstractMapDecorator<K,V> implements OrderedMap<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 |
|---|
AbstractOrderedMapDecorator(OrderedMap<K,V> map)
Constructor that wraps (not copies).
|
| Modifier and Type | Method and Description |
|---|---|
K |
firstKey()
Gets the first key currently in this map.
|
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.
|
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, valuesclear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuescontainsKey, containsValue, entrySet, get, isEmpty, keySet, remove, size, valuespublic AbstractOrderedMapDecorator(OrderedMap<K,V> map)
map - the map to decorate, must not be nulljava.lang.NullPointerException - if the map is nullpublic K firstKey()
OrderedMapfirstKey in interface OrderedMap<K,V>public K lastKey()
OrderedMaplastKey in interface OrderedMap<K,V>public K nextKey(K key)
OrderedMapnextKey in interface OrderedMap<K,V>key - the key to search for next frompublic K previousKey(K key)
OrderedMappreviousKey in interface OrderedMap<K,V>key - the key to search for previous frompublic OrderedMapIterator<K,V> mapIterator()
AbstractIterableMapMapIterator 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.
IterableMap<String,Integer> map = new HashedMap<String,Integer>();
MapIterator<String,Integer> 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 - 2023 Adobe. All Rights Reserved