java.util
public
interface
java.util.SortedMap
SortedMap is a Map where the iterators sequence in order of the sorted keys.
Known Indirect Subclasses
| TreeMap |
TreeMap is an implementation of SortedMap. |
Summary
Public Methods
Methods inherited
from interface
java.util.Map
clear,
containsKey,
containsValue,
entrySet,
equals,
get,
hashCode,
isEmpty,
keySet,
put,
putAll,
remove,
size,
values
Details
Public Methods
Answers the Comparator used to compare elements in this SortedMap.
Returns
- a Comparator or null if the natural order is used
public
K
firstKey()
Answer the first sorted key in this SortedMap.
public
SortedMap
headMap(K endKey)
Answers a
SortedMap of the specified portion of this
SortedMap which contains keys less than the end key. Users
should be aware that the return value is actually backed by this
SortedMap. Hence any modifications made to one will be
immediately visible to the other.
Returns
- a submap where the keys are less than
endKey
public
K
lastKey()
Answers the last sorted key in this SortedMap.
public
SortedMap
subMap(K startKey, K endKey)
Answers a SortedMap of the specified portion of this SortedMap which
contains keys greater or equal to the start key but less than the end
key. Users should be aware that the return value is actually backed by
this
SortedMap. Hence any modifications made to one will
be immediately visible to the other.
Parameters
| startKey
| the start key |
| endKey
| the end key |
Returns
- a submap where the keys are greater or equal to
startKey and less than endKey
public
SortedMap
tailMap(K startKey)
Answers a SortedMap of the specified portion of this SortedMap which
contains keys greater or equal to the start key. The returned SortedMap
is backed by this SortedMap so changes to one are reflected by the other.
Returns
- a submap where the keys are greater or equal to
startKey