|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.collections4.map.AbstractIterableMap<K,V>
org.apache.commons.collections4.map.AbstractMapDecorator<K,V>
org.apache.commons.collections4.map.AbstractSortedMapDecorator<K,V>
K
- the type of the keys in the mapV
- the type of the values in the mappublic abstract class AbstractSortedMapDecorator<K,V>
Provides a base decorator that enables additional functionality to be added to a Map via decoration.
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.
Nested Class Summary | |
---|---|
protected static class |
AbstractSortedMapDecorator.SortedMapIterator<K,V>
OrderedMapIterator implementation. |
Constructor Summary | |
---|---|
protected |
AbstractSortedMapDecorator()
Constructor only used in deserialization, do not use otherwise. |
|
AbstractSortedMapDecorator(SortedMap<K,V> map)
Constructor that wraps (not copies). |
Method Summary | |
---|---|
Comparator<? super K> |
comparator()
|
protected SortedMap<K,V> |
decorated()
Gets the map being decorated. |
K |
firstKey()
Gets the first key currently in this map. |
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.
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 |
K |
nextKey(K key)
Gets the next key after the one specified. |
K |
previousKey(K key)
Gets the previous key before the one specified. |
SortedMap<K,V> |
subMap(K fromKey,
K toKey)
|
SortedMap<K,V> |
tailMap(K fromKey)
|
Methods inherited from class org.apache.commons.collections4.map.AbstractMapDecorator |
---|
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.commons.collections4.Put |
---|
clear, put, putAll |
Methods inherited from interface org.apache.commons.collections4.Get |
---|
containsKey, containsValue, entrySet, get, isEmpty, keySet, remove, size, values |
Constructor Detail |
---|
protected AbstractSortedMapDecorator()
public AbstractSortedMapDecorator(SortedMap<K,V> map)
map
- the map to decorate, must not be null
IllegalArgumentException
- if the collection is nullMethod Detail |
---|
protected SortedMap<K,V> decorated()
decorated
in class AbstractMapDecorator<K,V>
public Comparator<? super K> comparator()
comparator
in interface SortedMap<K,V>
public K firstKey()
OrderedMap
firstKey
in interface SortedMap<K,V>
firstKey
in interface OrderedMap<K,V>
public K lastKey()
OrderedMap
lastKey
in interface SortedMap<K,V>
lastKey
in interface OrderedMap<K,V>
public SortedMap<K,V> subMap(K fromKey, K toKey)
subMap
in interface SortedMap<K,V>
public SortedMap<K,V> headMap(K toKey)
headMap
in interface SortedMap<K,V>
public SortedMap<K,V> tailMap(K fromKey)
tailMap
in interface SortedMap<K,V>
public K previousKey(K key)
OrderedMap
previousKey
in interface OrderedMap<K,V>
key
- the key to search for previous from
public K nextKey(K key)
OrderedMap
nextKey
in interface OrderedMap<K,V>
key
- the key to search for next from
public 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>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |