org.apache.commons.collections
public interface OrderedMap extends IterableMap
Since: Commons Collections 3.0
Version: $Revision: 155406 $ $Date: 2005-02-26 12:55:26 +0000 (Sat, 26 Feb 2005) $
Method Summary | |
---|---|
Object | firstKey()
Gets the first key currently in this map.
|
Object | lastKey()
Gets the last key currently in this map.
|
Object | nextKey(Object key)
Gets the next key after the one specified.
|
OrderedMapIterator | orderedMapIterator()
Obtains an OrderedMapIterator over the map.
|
Object | previousKey(Object key)
Gets the previous key before the one specified.
|
Returns: the first key currently in this map
Throws: java.util.NoSuchElementException if this map is empty
Returns: the last key currently in this map
Throws: java.util.NoSuchElementException if this map is empty
Parameters: key the key to search for next from
Returns: the next key, null if no match or at end
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(); }
Returns: a map iterator
Parameters: key the key to search for previous from
Returns: the previous key, null if no match or at start