Interface NavigableMap<K,V>
- Type Parameters:
K- the type of keyV- the type of value
- All Known Implementing Classes:
TreeMap
NavigableMap is a SortedMap with navigation methods answering the closest
matches for specified item.
- Since:
- 1.6
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionceilingEntry(K key) Answers an entry related with the smallest key greater than or equal to the specified key, or null if no such key.ceilingKey(K key) Answers the smallest key greater than or equal to the specified key, or null if no such key.Answers a NavigableSet view of the keys in descending order.Answers a reverse order view of the map.Answers the entry with the smallest key, or null if the map is empty.floorEntry(K key) Answers an entry related with the biggest key less than or equal to the specified key, or null if no such key.Answers the biggest key less than or equal to the specified key, or null if no such key.Answers a view of the head of the map whose keys are smaller than (or equal to, depends on inclusive argument) endKey.higherEntry(K key) Answers an entry related with the smallest key greater than the specified key, or null if no such key.Answers the smallest key greater than the specified key, or null if no such key.Answers the entry with the biggest key, or null if the map is empty.lowerEntry(K key) Answers an entry related with the biggest key less than the specified key, or null if no such key.Answers the biggest key less than the specified key, or null if no such key.Answers a NavigableSet view of the keys in ascending order.Deletes and answers the entry with the smallest key, or null if the map is empty.Deletes and answers the entry with the biggest key, or null if the map is empty.Answers a view of part of the map whose keys is from startKey to endKey.Answers a view of the tail of the map whose keys are bigger than (or equal to, depends on inclusive argument) startKey.
-
Method Details
-
firstEntry
-
lastEntry
-
pollFirstEntry
-
pollLastEntry
-
ceilingEntry
Answers an entry related with the smallest key greater than or equal to the specified key, or null if no such key.- Parameters:
key- the key- Returns:
- the entry, or null if no such key
- Throws:
ClassCastException- if the key cannot be compared with the keys in the mapNullPointerException- if the key is null and the map can not contain null key
-
ceilingKey
Answers the smallest key greater than or equal to the specified key, or null if no such key.- Parameters:
key- the key- Returns:
- the smallest key greater than or equal to key, or null if no such key
- Throws:
ClassCastException- if the key cannot be compared with the keys in the mapNullPointerException- if the key is null and the map can not contain null key
-
higherEntry
Answers an entry related with the smallest key greater than the specified key, or null if no such key.- Parameters:
key- the key- Returns:
- the entry, or null if no such key
- Throws:
ClassCastException- if the key cannot be compared with the keys in the mapNullPointerException- if the key is null and the map can not contain null key
-
higherKey
Answers the smallest key greater than the specified key, or null if no such key.- Parameters:
key- the key- Returns:
- the smallest key greater than key, or null if no such key
- Throws:
ClassCastException- if the key cannot be compared with the keys in the mapNullPointerException- if the key is null and the map can not contain null key
-
floorEntry
Answers an entry related with the biggest key less than or equal to the specified key, or null if no such key.- Parameters:
key- the key- Returns:
- the entry, or null if no such key
- Throws:
ClassCastException- if the key cannot be compared with the keys in the mapNullPointerException- if the key is null and the map can not contain null key
-
floorKey
Answers the biggest key less than or equal to the specified key, or null if no such key.- Parameters:
key- the key- Returns:
- the biggest key less than or equal to key, or null if no such key
- Throws:
ClassCastException- if the key cannot be compared with the keys in the mapNullPointerException- if the key is null and the map can not contain null key
-
lowerEntry
Answers an entry related with the biggest key less than the specified key, or null if no such key.- Parameters:
key- the key- Returns:
- the entry, or null if no such key
- Throws:
ClassCastException- if the key cannot be compared with the keys in the mapNullPointerException- if the key is null and the map can not contain null key
-
lowerKey
Answers the biggest key less than the specified key, or null if no such key.- Parameters:
key- the key- Returns:
- the biggest key less than key, or null if no such key
- Throws:
ClassCastException- if the key cannot be compared with the keys in the mapNullPointerException- if the key is null and the map can not contain null key
-
descendingMap
NavigableMap<K,V> descendingMap()Answers a reverse order view of the map.- Returns:
- the reverse order view of the map
-
descendingKeySet
NavigableSet<K> descendingKeySet()Answers a NavigableSet view of the keys in descending order.- Returns:
- the navigable set view
-
subMap
Answers a view of part of the map whose keys is from startKey to endKey.- Parameters:
startKey- the start keystartInclusive- true if the start key is in the returned mapendKey- the end keyendInclusive- true if the end key is in the returned map- Returns:
- the sub-map view
- Throws:
ClassCastException- when the class of the start or end key is inappropriate for this SubMapNullPointerException- when the start or end key is null and this SortedMap does not support null keysIllegalArgumentException- when the start key is greater than the end key
-
headMap
Answers a view of the head of the map whose keys are smaller than (or equal to, depends on inclusive argument) endKey.- Parameters:
endKey- the end keyinclusive- true if the end key is in the returned map- Returns:
- the head-map view
- Throws:
ClassCastException- when the class of the end key is inappropriate for this SubMapNullPointerException- when the end key is null and this SortedMap does not support null keysIllegalArgumentException- when the map is range-limited and end key is out of the range of the map
-
tailMap
Answers a view of the tail of the map whose keys are bigger than (or equal to, depends on inclusive argument) startKey.- Parameters:
startKey- the start keyinclusive- true if the start key is in the returned map- Returns:
- the tail-map view
- Throws:
ClassCastException- when the class of the start key is inappropriate for this SubMapNullPointerException- when the start key is null and this SortedMap does not support null keysIllegalArgumentException- when the map is range-limited and start key is out of the range of the map
-