org.apache.commons.collections.OrderedMap |
Known Indirect Subclasses
AbstractLinkedMap,
AbstractOrderedBidiMapDecorator,
AbstractOrderedMapDecorator,
AbstractSortedBidiMapDecorator,
DualTreeBidiMap,
LRUMap,
LinkedMap,
ListOrderedMap,
OrderedBidiMap,
SingletonMap,
SortedBidiMap,
TreeBidiMap,
UnmodifiableOrderedBidiMap,
UnmodifiableOrderedMap,
UnmodifiableSortedBidiMap
AbstractLinkedMap |
An abstract implementation of a hash-based map that links entries to create an
ordered map and which provides numerous points for subclasses to override. |
AbstractOrderedBidiMapDecorator |
Provides a base decorator that enables additional functionality to be added
to an OrderedBidiMap via decoration. |
AbstractOrderedMapDecorator |
Provides a base decorator that enables additional functionality to be added
to an OrderedMap via decoration. |
AbstractSortedBidiMapDecorator |
Provides a base decorator that enables additional functionality to be added
to a SortedBidiMap via decoration. |
DualTreeBidiMap |
Implementation of BidiMap that uses two TreeMap instances. |
LRUMap |
A Map implementation with a fixed maximum size which removes
the least recently used entry if an entry is added when full. |
LinkedMap |
A Map implementation that maintains the order of the entries. |
ListOrderedMap |
Decorates a Map to ensure that the order of addition is retained
using a List to maintain order. |
OrderedBidiMap |
Defines a map that allows bidirectional lookup between key and values
and retains and provides access to an ordering. |
SingletonMap |
A Map implementation that holds a single item and is fixed size. |
SortedBidiMap |
Defines a map that allows bidirectional lookup between key and values
and retains both keys and values in sorted order. |
TreeBidiMap |
Red-Black tree-based implementation of BidiMap where all objects added
implement the Comparable interface. |
UnmodifiableOrderedBidiMap |
Decorates another OrderedBidiMap to ensure it can't be altered. |
UnmodifiableOrderedMap |
Decorates another OrderedMap to ensure it can't be altered. |
UnmodifiableSortedBidiMap |
Decorates another SortedBidiMap to ensure it can't be altered. |
|
Class Overview
Defines a map that maintains order and allows both forward and backward
iteration through that order.
Public Methods
public
abstract
Object
firstKey
()
Gets the first key currently in this map.
Returns
- the first key currently in this map
public
abstract
Object
lastKey
()
Gets the last key currently in this map.
Returns
- the last key currently in this map
public
abstract
Object
nextKey
(Object 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
public
abstract
OrderedMapIterator
orderedMapIterator
()
Obtains an OrderedMapIterator
over the map.
A ordered map iterator is an efficient way of iterating over maps
in both directions.
BidiMap map = new TreeBidiMap();
MapIterator it = map.mapIterator();
while (it.hasNext()) {
Object key = it.next();
Object value = it.getValue();
it.setValue("newValue");
Object previousKey = it.previous();
}
public
abstract
Object
previousKey
(Object key)
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