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:
IterableMap<K,
,V> Map<K,
V>
- All Known Subinterfaces:
IterableSortedMap<K,
,V> OrderedBidiMap<K,
,V> SortedBidiMap<K,
V>
- All Known Implementing Classes:
AbstractLinkedMap
,AbstractOrderedMapDecorator
,AbstractSortedMapDecorator
,DualTreeBidiMap
,DualTreeBidiMap.ViewMap
,LinkedMap
,LRUMap
,LRUMap
,TreeBidiMap
,UnmodifiableOrderedMap
Defines a map that maintains order and allows both forward and backward
iteration through that order.
- Since:
- 3.0
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionfirstKey()
Gets the first key currently in this map.lastKey()
Gets the last key currently in this map.Obtains anOrderedMapIterator
over the map.Gets the next key after the one specified.previousKey
(K key) Gets the previous key before the one specified.Methods inherited from interface org.apache.openjpa.lib.util.collections.IterableMap
clear, put, putAll
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Method Details
-
mapIterator
OrderedMapIterator<K,V> mapIterator()Obtains anOrderedMapIterator
over the map.A ordered map iterator is an efficient way of iterating over maps in both directions.
- Specified by:
mapIterator
in interfaceIterableMap<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:
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:
NoSuchElementException
- if this map is empty
-
nextKey
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
-
previousKey
Gets the previous key before the one specified.- Parameters:
key
- the key to search for previous from- Returns:
- the previous key, null if no match or at start
-