public interface SortedMap<K,V> extends Map<K,V>
| Modifier and Type | Method and Description |
|---|---|
Comparator<? super K> |
comparator()
Returns the comparator used to compare keys in this sorted map.
|
K |
firstKey()
Returns the first key in this sorted map.
|
SortedMap<K,V> |
headMap(K endKey)
Returns a sorted map over a range of this sorted map with all keys that
are less than the specified
endKey. |
K |
lastKey()
Returns the last key in this sorted map.
|
SortedMap<K,V> |
subMap(K startKey,
K endKey)
Returns a sorted map over a range of this sorted map with all keys
greater than or equal to the specified
startKey and less than the
specified endKey. |
SortedMap<K,V> |
tailMap(K startKey)
Returns a sorted map over a range of this sorted map with all keys that
are greater than or equal to the specified
startKey. |
Comparator<? super K> comparator()
null if the natural order is used.K firstKey()
NoSuchElementException - if this sorted map is empty.SortedMap<K,V> headMap(K endKey)
endKey. Changes to the returned
sorted map are reflected in this sorted map and vice versa.
Note: The returned map will not allow an insertion of a key outside the specified range.
endKey - the high boundary of the range specified.endKey.ClassCastException - if the class of the end key is inappropriate for this sorted
map.NullPointerException - if the end key is null and this sorted map does not
support null keys.IllegalArgumentException - if this map is itself a sorted map over a range of another
map and the specified key is outside of its range.K lastKey()
NoSuchElementException - if this sorted map is empty.SortedMap<K,V> subMap(K startKey, K endKey)
startKey and less than the
specified endKey. Changes to the returned sorted map are
reflected in this sorted map and vice versa.
Note: The returned map will not allow an insertion of a key outside the specified range.
startKey - the low boundary of the range (inclusive).endKey - the high boundary of the range (exclusive),ClassCastException - if the class of the start or end key is inappropriate for
this sorted map.NullPointerException - if the start or end key is null and this sorted map
does not support null keys.IllegalArgumentException - if the start key is greater than the end key, or if this map
is itself a sorted map over a range of another sorted map and
the specified range is outside of its range.SortedMap<K,V> tailMap(K startKey)
startKey. Changes to
the returned sorted map are reflected in this sorted map and vice versa.
Note: The returned map will not allow an insertion of a key outside the specified range.
startKey - the low boundary of the range specified.startKey.ClassCastException - if the class of the start key is inappropriate for this
sorted map.NullPointerException - if the start key is null and this sorted map does not
support null keys.IllegalArgumentException - if this map itself a sorted map over a range of another map
and the specified key is outside of its range.