Interface SortedMap<K,V>
- All Superinterfaces:
Map<K,V>
- All Known Subinterfaces:
NavigableMap<K,V>
- All Known Implementing Classes:
TreeMap
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionComparator<? super K> Returns the comparator used to compare keys in this sorted map.firstKey()Returns the first key in this sorted map.Returns a sorted map over a range of this sorted map with all keys that are less than the specifiedendKey.lastKey()Returns the last key in this sorted map.Returns a sorted map over a range of this sorted map with all keys greater than or equal to the specifiedstartKeyand less than the specifiedendKey.Returns a sorted map over a range of this sorted map with all keys that are greater than or equal to the specifiedstartKey.
-
Method Details
-
comparator
Comparator<? super K> comparator()Returns the comparator used to compare keys in this sorted map.
Returns
the comparator or
nullif the natural order is used. -
firstKey
K firstKey()Returns the first key in this sorted map.
Returns
the first key in this sorted map.
Throws
NoSuchElementException: if this sorted map is empty.
-
headMap
Returns a sorted map over a range of this sorted map with all keys that are 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.
Parameters
endKey: the high boundary of the range specified.
Returns
a sorted map where the keys are less than
endKey.Throws
-
ClassCastException: @throws ClassCastException if the class of the end key is inappropriate for this sorted map. -
NullPointerException: @throws NullPointerException if the end key isnulland this sorted map does not supportnullkeys. -
IllegalArgumentException: @throws IllegalArgumentException if this map is itself a sorted map over a range of another map and the specified key is outside of its range.
-
lastKey
K lastKey()Returns the last key in this sorted map.
Returns
the last key in this sorted map.
Throws
NoSuchElementException: if this sorted map is empty.
-
subMap
Returns a sorted map over a range of this sorted map with all keys greater than or equal to the specified
startKeyand less than the specifiedendKey. 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.
Parameters
-
startKey: the low boundary of the range (inclusive). -
endKey: the high boundary of the range (exclusive),
Returns
a sorted map with the key from the specified range.
Throws
-
ClassCastException: @throws ClassCastException if the class of the start or end key is inappropriate for this sorted map. -
NullPointerException: @throws NullPointerException if the start or end key isnulland this sorted map does not supportnullkeys. -
IllegalArgumentException: @throws 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.
-
-
tailMap
Returns a sorted map over a range of this sorted map with all keys that are greater than or equal to the specified
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.
Parameters
startKey: the low boundary of the range specified.
Returns
- Returns:
a sorted map where the keys are greater or equal to
startKey.Throws
-
ClassCastException: @throws ClassCastException if the class of the start key is inappropriate for this sorted map. -
NullPointerException: @throws NullPointerException if the start key isnulland this sorted map does not supportnullkeys. -
IllegalArgumentException: @throws IllegalArgumentException if this map itself a sorted map over a range of another map and the specified key is outside of its range.
-
-