java.util
public
interface
java.util.SortedMap<K, V>
java.util.SortedMap<K, V> |
Map<K, V>
|
SortedMap is a Map where the iterators sequence in order of the sorted keys.
Known Indirect Subclasses
TreeMap<K, V> |
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
public
Comparator<? super K>
comparator()
Returns 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<K, V>
headMap(K endKey)
Returns 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()
Returns the last sorted key in this SortedMap.
public
SortedMap<K, V>
subMap(K startKey, K endKey)
Returns 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<K, V>
tailMap(K startKey)
Returns 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