Package org.apache.commons.collections4
Interface OrderedMap<K,V>
-
- Type Parameters:
K- the type of the keys in the mapV- the type of the values in the map
- All Superinterfaces:
Get<K,V>,IterableGet<K,V>,IterableMap<K,V>,java.util.Map<K,V>,Put<K,V>
- All Known Subinterfaces:
IterableSortedMap<K,V>,OrderedBidiMap<K,V>,SortedBidiMap<K,V>,Trie<K,V>
- All Known Implementing Classes:
AbstractBitwiseTrie,AbstractLinkedMap,AbstractOrderedBidiMapDecorator,AbstractOrderedMapDecorator,AbstractSortedBidiMapDecorator,AbstractSortedMapDecorator,DualTreeBidiMap,FixedSizeSortedMap,LinkedMap,ListOrderedMap,LRUMap,PatriciaTrie,SingletonMap,TreeBidiMap,UnmodifiableOrderedBidiMap,UnmodifiableOrderedMap,UnmodifiableSortedBidiMap,UnmodifiableSortedMap,UnmodifiableTrie
public interface OrderedMap<K,V> extends IterableMap<K,V>
Defines a map that maintains order and allows both forward and backward iteration through that order.- Since:
- 3.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description KfirstKey()Gets the first key currently in this map.KlastKey()Gets the last key currently in this map.OrderedMapIterator<K,V>mapIterator()Obtains anOrderedMapIteratorover the map.KnextKey(K key)Gets the next key after the one specified.KpreviousKey(K key)Gets the previous key before the one specified.-
Methods inherited from interface org.apache.commons.collections4.Get
containsKey, containsValue, entrySet, get, isEmpty, keySet, remove, size, values
-
-
-
-
Method Detail
-
mapIterator
OrderedMapIterator<K,V> mapIterator()
Obtains anOrderedMapIteratorover the map.A ordered map iterator is an efficient way of iterating over maps in both directions.
- Specified by:
mapIteratorin interfaceIterableGet<K,V>- Returns:
- a map iterator
-
firstKey
K firstKey()
Gets the first key currently in this map.- Returns:
- the first key currently in this map
- Throws:
java.util.NoSuchElementException- if this map is empty
-
lastKey
K lastKey()
Gets the last key currently in this map.- Returns:
- the last key currently in this map
- Throws:
java.util.NoSuchElementException- if this map is empty
-
nextKey
K nextKey(K key)
Gets the next key after the one specified.- Parameters:
key- the key to search for next from- Returns:
- the next key, null if no match or at end
-
-