# NavigableMap

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Methods](https://developer.android.com/reference/java/util/NavigableMap#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/java/util/NavigableMap#inhmethods)  

# NavigableMap

`
public


interface
NavigableMap
`  
`


implements

`[SortedMap](https://developer.android.com/reference/java/util/SortedMap)`<K, V>


`

|--------------------------------|
| java.util.NavigableMap\<K, V\> |

|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known indirect subclasses [ConcurrentNavigableMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentNavigableMap)\<K, V\>,[ConcurrentSkipListMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentSkipListMap)\<K, V\>,[TreeMap](https://developer.android.com/reference/java/util/TreeMap)\<K, V\> |-----------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [ConcurrentNavigableMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentNavigableMap)\<K, V\> | A[ConcurrentMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentMap)supporting[NavigableMap](https://developer.android.com/reference/java/util/NavigableMap)operations, and recursively so for its navigable sub-maps. | | [ConcurrentSkipListMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentSkipListMap)\<K, V\>   | A scalable concurrent[ConcurrentNavigableMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentNavigableMap)implementation.                                                                                              | | [TreeMap](https://developer.android.com/reference/java/util/TreeMap)\<K, V\>                                          | A Red-Black tree based[NavigableMap](https://developer.android.com/reference/java/util/NavigableMap)implementation.                                                                                                                            | |

<br />

*** ** * ** ***

A[SortedMap](https://developer.android.com/reference/java/util/SortedMap)extended with navigation methods returning the closest matches for given search targets. Methods[lowerEntry(K)](https://developer.android.com/reference/java/util/NavigableMap#lowerEntry(K)),[floorEntry(K)](https://developer.android.com/reference/java/util/NavigableMap#floorEntry(K)),[ceilingEntry(K)](https://developer.android.com/reference/java/util/NavigableMap#ceilingEntry(K)), and[higherEntry(K)](https://developer.android.com/reference/java/util/NavigableMap#higherEntry(K))return`Map.Entry`objects associated with keys respectively less than, less than or equal, greater than or equal, and greater than a given key, returning`null`if there is no such key. Similarly, methods[lowerKey(K)](https://developer.android.com/reference/java/util/NavigableMap#lowerKey(K)),[floorKey(K)](https://developer.android.com/reference/java/util/NavigableMap#floorKey(K)),[ceilingKey(K)](https://developer.android.com/reference/java/util/NavigableMap#ceilingKey(K)), and[higherKey(K)](https://developer.android.com/reference/java/util/NavigableMap#higherKey(K))return only the associated keys. All of these methods are designed for locating, not traversing entries.

A`NavigableMap`may be accessed and traversed in either ascending or descending key order. The[descendingMap()](https://developer.android.com/reference/java/util/NavigableMap#descendingMap())method returns a view of the map with the senses of all relational and directional methods inverted. The performance of ascending operations and views is likely to be faster than that of descending ones. Methods[subMap(K, boolean, K, boolean)](https://developer.android.com/reference/java/util/NavigableMap#subMap(K,%20boolean,%20K,%20boolean)),[headMap(K, boolean)](https://developer.android.com/reference/java/util/NavigableMap#headMap(K,%20boolean)), and[tailMap(K, boolean)](https://developer.android.com/reference/java/util/NavigableMap#tailMap(K,%20boolean))differ from the like-named`SortedMap`methods in accepting additional arguments describing whether lower and upper bounds are inclusive versus exclusive. Submaps of any`NavigableMap`must implement the`NavigableMap`interface.

This interface additionally defines methods[firstEntry()](https://developer.android.com/reference/java/util/NavigableMap#firstEntry()),[pollFirstEntry()](https://developer.android.com/reference/java/util/NavigableMap#pollFirstEntry()),[lastEntry()](https://developer.android.com/reference/java/util/NavigableMap#lastEntry()), and[pollLastEntry()](https://developer.android.com/reference/java/util/NavigableMap#pollLastEntry())that return and/or remove the least and greatest mappings, if any exist, else returning`null`.

The methods[ceilingEntry(K)](https://developer.android.com/reference/java/util/NavigableMap#ceilingEntry(K)),[firstEntry()](https://developer.android.com/reference/java/util/NavigableMap#firstEntry()),[floorEntry(K)](https://developer.android.com/reference/java/util/NavigableMap#floorEntry(K)),[higherEntry(K)](https://developer.android.com/reference/java/util/NavigableMap#higherEntry(K)),[lastEntry()](https://developer.android.com/reference/java/util/NavigableMap#lastEntry()),[lowerEntry(K)](https://developer.android.com/reference/java/util/NavigableMap#lowerEntry(K)),[pollFirstEntry()](https://developer.android.com/reference/java/util/NavigableMap#pollFirstEntry()), and[pollLastEntry()](https://developer.android.com/reference/java/util/NavigableMap#pollLastEntry())return[Map.Entry](https://developer.android.com/reference/java/util/Map.Entry)instances that represent snapshots of mappings as of the time of the call. They do*not* support mutation of the underlying map via the optional[setValue](https://developer.android.com/reference/java/util/Map.Entry#setValue(V))method.

Methods[subMap(K, K)](https://developer.android.com/reference/java/util/NavigableMap#subMap(K,%20K)),[headMap(K)](https://developer.android.com/reference/java/util/NavigableMap#headMap(K)), and[tailMap(K)](https://developer.android.com/reference/java/util/NavigableMap#tailMap(K))are specified to return`SortedMap`to allow existing implementations of`SortedMap`to be compatibly retrofitted to implement`NavigableMap`, but extensions and implementations of this interface are encouraged to override these methods to return`NavigableMap`. Similarly,[SortedMap.keySet()](https://developer.android.com/reference/java/util/SortedMap#keySet())can be overridden to return[NavigableSet](https://developer.android.com/reference/java/util/NavigableSet).

## Summary

|                                                                                                                                                                                                              ### Public methods                                                                                                                                                                                                               ||
|----------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract `[Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>`           | ` `[ceilingEntry](https://developer.android.com/reference/java/util/NavigableMap#ceilingEntry(K))`(K key) ` Returns a key-value mapping associated with the least key greater than or equal to the given key, or`null`if there is no such key.                                                                                            |
| ` abstract K`                                                                                      | ` `[ceilingKey](https://developer.android.com/reference/java/util/NavigableMap#ceilingKey(K))`(K key) ` Returns the least key greater than or equal to the given key, or`null`if there is no such key.                                                                                                                                    |
| ` abstract `[NavigableSet](https://developer.android.com/reference/java/util/NavigableSet)`<K>`    | ` `[descendingKeySet](https://developer.android.com/reference/java/util/NavigableMap#descendingKeySet())`() ` Returns a reverse order[NavigableSet](https://developer.android.com/reference/java/util/NavigableSet)view of the keys contained in this map.                                                                                |
| ` abstract `[NavigableMap](https://developer.android.com/reference/java/util/NavigableMap)`<K, V>` | ` `[descendingMap](https://developer.android.com/reference/java/util/NavigableMap#descendingMap())`() ` Returns a reverse order view of the mappings contained in this map.                                                                                                                                                               |
| ` abstract `[Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>`           | ` `[firstEntry](https://developer.android.com/reference/java/util/NavigableMap#firstEntry())`() ` Returns a key-value mapping associated with the least key in this map, or`null`if the map is empty.                                                                                                                                     |
| ` abstract `[Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>`           | ` `[floorEntry](https://developer.android.com/reference/java/util/NavigableMap#floorEntry(K))`(K key) ` Returns a key-value mapping associated with the greatest key less than or equal to the given key, or`null`if there is no such key.                                                                                                |
| ` abstract K`                                                                                      | ` `[floorKey](https://developer.android.com/reference/java/util/NavigableMap#floorKey(K))`(K key) ` Returns the greatest key less than or equal to the given key, or`null`if there is no such key.                                                                                                                                        |
| ` abstract `[SortedMap](https://developer.android.com/reference/java/util/SortedMap)`<K, V>`       | ` `[headMap](https://developer.android.com/reference/java/util/NavigableMap#headMap(K))`(K toKey) ` Returns a view of the portion of this map whose keys are strictly less than`toKey`. Equivalent to`headMap(toKey, false)`.                                                                                                             |
| ` abstract `[NavigableMap](https://developer.android.com/reference/java/util/NavigableMap)`<K, V>` | ` `[headMap](https://developer.android.com/reference/java/util/NavigableMap#headMap(K,%20boolean))`(K toKey, boolean inclusive) ` Returns a view of the portion of this map whose keys are less than (or equal to, if`inclusive`is true)`toKey`.                                                                                          |
| ` abstract `[Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>`           | ` `[higherEntry](https://developer.android.com/reference/java/util/NavigableMap#higherEntry(K))`(K key) ` Returns a key-value mapping associated with the least key strictly greater than the given key, or`null`if there is no such key.                                                                                                 |
| ` abstract K`                                                                                      | ` `[higherKey](https://developer.android.com/reference/java/util/NavigableMap#higherKey(K))`(K key) ` Returns the least key strictly greater than the given key, or`null`if there is no such key.                                                                                                                                         |
| ` abstract `[Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>`           | ` `[lastEntry](https://developer.android.com/reference/java/util/NavigableMap#lastEntry())`() ` Returns a key-value mapping associated with the greatest key in this map, or`null`if the map is empty.                                                                                                                                    |
| ` abstract `[Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>`           | ` `[lowerEntry](https://developer.android.com/reference/java/util/NavigableMap#lowerEntry(K))`(K key) ` Returns a key-value mapping associated with the greatest key strictly less than the given key, or`null`if there is no such key.                                                                                                   |
| ` abstract K`                                                                                      | ` `[lowerKey](https://developer.android.com/reference/java/util/NavigableMap#lowerKey(K))`(K key) ` Returns the greatest key strictly less than the given key, or`null`if there is no such key.                                                                                                                                           |
| ` abstract `[NavigableSet](https://developer.android.com/reference/java/util/NavigableSet)`<K>`    | ` `[navigableKeySet](https://developer.android.com/reference/java/util/NavigableMap#navigableKeySet())`() ` Returns a[NavigableSet](https://developer.android.com/reference/java/util/NavigableSet)view of the keys contained in this map.                                                                                                |
| ` abstract `[Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>`           | ` `[pollFirstEntry](https://developer.android.com/reference/java/util/NavigableMap#pollFirstEntry())`() ` Removes and returns a key-value mapping associated with the least key in this map, or`null`if the map is empty.                                                                                                                 |
| ` abstract `[Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>`           | ` `[pollLastEntry](https://developer.android.com/reference/java/util/NavigableMap#pollLastEntry())`() ` Removes and returns a key-value mapping associated with the greatest key in this map, or`null`if the map is empty.                                                                                                                |
| ` default `[NavigableMap](https://developer.android.com/reference/java/util/NavigableMap)`<K, V>`  | ` `[reversed](https://developer.android.com/reference/java/util/NavigableMap#reversed())`() ` Returns a reverse-ordered[view](https://developer.android.com/reference/java/util/Collection#view)of this map. This method is equivalent to[descendingMap](https://developer.android.com/reference/java/util/NavigableMap#descendingMap()). |
| ` abstract `[SortedMap](https://developer.android.com/reference/java/util/SortedMap)`<K, V>`       | ` `[subMap](https://developer.android.com/reference/java/util/NavigableMap#subMap(K,%20K))`(K fromKey, K toKey) ` Returns a view of the portion of this map whose keys range from`fromKey`, inclusive, to`toKey`, exclusive. Equivalent to`subMap(fromKey, true, toKey, false)`.                                                          |
| ` abstract `[NavigableMap](https://developer.android.com/reference/java/util/NavigableMap)`<K, V>` | ` `[subMap](https://developer.android.com/reference/java/util/NavigableMap#subMap(K,%20boolean,%20K,%20boolean))`(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) ` Returns a view of the portion of this map whose keys range from`fromKey`to`toKey`.                                                                    |
| ` abstract `[NavigableMap](https://developer.android.com/reference/java/util/NavigableMap)`<K, V>` | ` `[tailMap](https://developer.android.com/reference/java/util/NavigableMap#tailMap(K,%20boolean))`(K fromKey, boolean inclusive) ` Returns a view of the portion of this map whose keys are greater than (or equal to, if`inclusive`is true)`fromKey`.                                                                                   |
| ` abstract `[SortedMap](https://developer.android.com/reference/java/util/SortedMap)`<K, V>`       | ` `[tailMap](https://developer.android.com/reference/java/util/NavigableMap#tailMap(K))`(K fromKey) ` Returns a view of the portion of this map whose keys are greater than or equal to`fromKey`. Equivalent to`tailMap(fromKey, true)`.                                                                                                  |

| ### Inherited methods |
|-----------------------|---|
| From interface` `[java.util.SortedMap](https://developer.android.com/reference/java/util/SortedMap)` ` |----------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract `[Comparator](https://developer.android.com/reference/java/util/Comparator)`<? super K>`                                                      | ` `[comparator](https://developer.android.com/reference/java/util/SortedMap#comparator())`() ` Returns the comparator used to order the keys in this map, or`null`if this map uses the[natural ordering](https://developer.android.com/reference/java/lang/Comparable)of its keys. | | ` abstract `[Set](https://developer.android.com/reference/java/util/Set)`<`[Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>>` | ` `[entrySet](https://developer.android.com/reference/java/util/SortedMap#entrySet())`() ` Returns a[Set](https://developer.android.com/reference/java/util/Set)view of the mappings contained in this map.                                                                        | | ` abstract K`                                                                                                                                            | ` `[firstKey](https://developer.android.com/reference/java/util/SortedMap#firstKey())`() ` Returns the first (lowest) key currently in this map.                                                                                                                                   | | ` abstract `[SortedMap](https://developer.android.com/reference/java/util/SortedMap)`<K, V>`                                                             | ` `[headMap](https://developer.android.com/reference/java/util/SortedMap#headMap(K))`(K toKey) ` Returns a view of the portion of this map whose keys are strictly less than`toKey`.                                                                                               | | ` abstract `[Set](https://developer.android.com/reference/java/util/Set)`<K>`                                                                            | ` `[keySet](https://developer.android.com/reference/java/util/SortedMap#keySet())`() ` Returns a[Set](https://developer.android.com/reference/java/util/Set)view of the keys contained in this map.                                                                                | | ` abstract K`                                                                                                                                            | ` `[lastKey](https://developer.android.com/reference/java/util/SortedMap#lastKey())`() ` Returns the last (highest) key currently in this map.                                                                                                                                     | | ` default V`                                                                                                                                             | ` `[putFirst](https://developer.android.com/reference/java/util/SortedMap#putFirst(K,%20V))`(K k, V v) ` Throws`UnsupportedOperationException`.                                                                                                                                    | | ` default V`                                                                                                                                             | ` `[putLast](https://developer.android.com/reference/java/util/SortedMap#putLast(K,%20V))`(K k, V v) ` Throws`UnsupportedOperationException`.                                                                                                                                      | | ` default `[SortedMap](https://developer.android.com/reference/java/util/SortedMap)`<K, V>`                                                              | ` `[reversed](https://developer.android.com/reference/java/util/SortedMap#reversed())`() ` Returns a reverse-ordered[view](https://developer.android.com/reference/java/util/Collection#view)of this map.                                                                          | | ` abstract `[SortedMap](https://developer.android.com/reference/java/util/SortedMap)`<K, V>`                                                             | ` `[subMap](https://developer.android.com/reference/java/util/SortedMap#subMap(K,%20K))`(K fromKey, K toKey) ` Returns a view of the portion of this map whose keys range from`fromKey`, inclusive, to`toKey`, exclusive.                                                          | | ` abstract `[SortedMap](https://developer.android.com/reference/java/util/SortedMap)`<K, V>`                                                             | ` `[tailMap](https://developer.android.com/reference/java/util/SortedMap#tailMap(K))`(K fromKey) ` Returns a view of the portion of this map whose keys are greater than or equal to`fromKey`.                                                                                     | | ` abstract `[Collection](https://developer.android.com/reference/java/util/Collection)`<V>`                                                              | ` `[values](https://developer.android.com/reference/java/util/SortedMap#values())`() ` Returns a[Collection](https://developer.android.com/reference/java/util/Collection)view of the values contained in this map.                                                                | ||
| From interface` `[java.util.Map](https://developer.android.com/reference/java/util/Map)` ` |----------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract void`                                                                                                                                         | ` `[clear](https://developer.android.com/reference/java/util/Map#clear())`() ` Removes all of the mappings from this map (optional operation).                                                                                                                                                                                                                                                                                                                                                  | | ` default V`                                                                                                                                             | ` `[compute](https://developer.android.com/reference/java/util/Map#compute(K,%20java.util.function.BiFunction<?%20super%20K,?%20super%20V,?%20extends%20V>))`(K key, `[BiFunction](https://developer.android.com/reference/java/util/function/BiFunction)`<? super K, ? super V, ? extends V> remappingFunction) ` Attempts to compute a mapping for the specified key and its current mapped value (or`null`if there is no current mapping).                                                   | | ` default V`                                                                                                                                             | ` `[computeIfAbsent](https://developer.android.com/reference/java/util/Map#computeIfAbsent(K,%20java.util.function.Function<?%20super%20K,?%20extends%20V>))`(K key, `[Function](https://developer.android.com/reference/java/util/function/Function)`<? super K, ? extends V> mappingFunction) ` If the specified key is not already associated with a value (or is mapped to`null`), attempts to compute its value using the given mapping function and enters it into this map unless`null`. | | ` default V`                                                                                                                                             | ` `[computeIfPresent](https://developer.android.com/reference/java/util/Map#computeIfPresent(K,%20java.util.function.BiFunction<?%20super%20K,?%20super%20V,?%20extends%20V>))`(K key, `[BiFunction](https://developer.android.com/reference/java/util/function/BiFunction)`<? super K, ? super V, ? extends V> remappingFunction) ` If the value for the specified key is present and non-null, attempts to compute a new mapping given the key and its current mapped value.                  | | ` abstract boolean`                                                                                                                                      | ` `[containsKey](https://developer.android.com/reference/java/util/Map#containsKey(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` key) ` Returns`true`if this map contains a mapping for the specified key.                                                                                                                                                                                                                                           | | ` abstract boolean`                                                                                                                                      | ` `[containsValue](https://developer.android.com/reference/java/util/Map#containsValue(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` value) ` Returns`true`if this map maps one or more keys to the specified value.                                                                                                                                                                                                                                 | | ` static <K, V> `[Map](https://developer.android.com/reference/java/util/Map)`<K, V>`                                                                    | ` `[copyOf](https://developer.android.com/reference/java/util/Map#copyOf(java.util.Map<?%20extends%20K,?%20extends%20V>))`(`[Map](https://developer.android.com/reference/java/util/Map)`<? extends K, ? extends V> map) ` Returns an[unmodifiable Map](https://developer.android.com/reference/java/util/NavigableMap#unmodifiable)containing the entries of the given Map.                                                                                                                    | | ` static <K, V> `[Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>`                                                            | ` `[entry](https://developer.android.com/reference/java/util/Map#entry(K,%20V))`(K k, V v) ` Returns an unmodifiable[Entry](https://developer.android.com/reference/java/util/Map.Entry)containing the given key and value.                                                                                                                                                                                                                                                                     | | ` abstract `[Set](https://developer.android.com/reference/java/util/Set)`<`[Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>>` | ` `[entrySet](https://developer.android.com/reference/java/util/Map#entrySet())`() ` Returns a[Set](https://developer.android.com/reference/java/util/Set)view of the mappings contained in this map.                                                                                                                                                                                                                                                                                           | | ` abstract boolean`                                                                                                                                      | ` `[equals](https://developer.android.com/reference/java/util/Map#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` o) ` Compares the specified object with this map for equality.                                                                                                                                                                                                                                                                | | ` default void`                                                                                                                                          | ` `[forEach](https://developer.android.com/reference/java/util/Map#forEach(java.util.function.BiConsumer<?%20super%20K,?%20super%20V>))`(`[BiConsumer](https://developer.android.com/reference/java/util/function/BiConsumer)`<? super K, ? super V> action) ` Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.                                                                                                    | | ` abstract V`                                                                                                                                            | ` `[get](https://developer.android.com/reference/java/util/Map#get(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` key) ` Returns the value to which the specified key is mapped, or`null`if this map contains no mapping for the key.                                                                                                                                                                                                                 | | ` default V`                                                                                                                                             | ` `[getOrDefault](https://developer.android.com/reference/java/util/Map#getOrDefault(java.lang.Object,%20V))`(`[Object](https://developer.android.com/reference/java/lang/Object)` key, V defaultValue) ` Returns the value to which the specified key is mapped, or`defaultValue`if this map contains no mapping for the key.                                                                                                                                                                  | | ` abstract int`                                                                                                                                          | ` `[hashCode](https://developer.android.com/reference/java/util/Map#hashCode())`() ` Returns the hash code value for this map.                                                                                                                                                                                                                                                                                                                                                                  | | ` abstract boolean`                                                                                                                                      | ` `[isEmpty](https://developer.android.com/reference/java/util/Map#isEmpty())`() ` Returns`true`if this map contains no key-value mappings.                                                                                                                                                                                                                                                                                                                                                     | | ` abstract `[Set](https://developer.android.com/reference/java/util/Set)`<K>`                                                                            | ` `[keySet](https://developer.android.com/reference/java/util/Map#keySet())`() ` Returns a[Set](https://developer.android.com/reference/java/util/Set)view of the keys contained in this map.                                                                                                                                                                                                                                                                                                   | | ` default V`                                                                                                                                             | ` `[merge](https://developer.android.com/reference/java/util/Map#merge(K,%20V,%20java.util.function.BiFunction<?%20super%20V,?%20super%20V,?%20extends%20V>))`(K key, V value, `[BiFunction](https://developer.android.com/reference/java/util/function/BiFunction)`<? super V, ? super V, ? extends V> remappingFunction) ` If the specified key is not already associated with a value or is associated with null, associates it with the given non-null value.                               | | ` static <K, V> `[Map](https://developer.android.com/reference/java/util/Map)`<K, V>`                                                                    | ` `[of](https://developer.android.com/reference/java/util/Map#of(K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V))`(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) ` Returns an unmodifiable map containing five mappings.                                                                                                                                                                                                                                                          | | ` static <K, V> `[Map](https://developer.android.com/reference/java/util/Map)`<K, V>`                                                                    | ` `[of](https://developer.android.com/reference/java/util/Map#of(K,%20V,%20K,%20V,%20K,%20V,%20K,%20V))`(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) ` Returns an unmodifiable map containing four mappings.                                                                                                                                                                                                                                                                                | | ` static <K, V> `[Map](https://developer.android.com/reference/java/util/Map)`<K, V>`                                                                    | ` `[of](https://developer.android.com/reference/java/util/Map#of(K,%20V))`(K k1, V v1) ` Returns an unmodifiable map containing a single mapping.                                                                                                                                                                                                                                                                                                                                               | | ` static <K, V> `[Map](https://developer.android.com/reference/java/util/Map)`<K, V>`                                                                    | ` `[of](https://developer.android.com/reference/java/util/Map#of(K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V))`(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8) ` Returns an unmodifiable map containing eight mappings.                                                                                                                                                                                       | | ` static <K, V> `[Map](https://developer.android.com/reference/java/util/Map)`<K, V>`                                                                    | ` `[of](https://developer.android.com/reference/java/util/Map#of(K,%20V,%20K,%20V))`(K k1, V v1, K k2, V v2) ` Returns an unmodifiable map containing two mappings.                                                                                                                                                                                                                                                                                                                             | | ` static <K, V> `[Map](https://developer.android.com/reference/java/util/Map)`<K, V>`                                                                    | ` `[of](https://developer.android.com/reference/java/util/Map#of(K,%20V,%20K,%20V,%20K,%20V))`(K k1, V v1, K k2, V v2, K k3, V v3) ` Returns an unmodifiable map containing three mappings.                                                                                                                                                                                                                                                                                                     | | ` static <K, V> `[Map](https://developer.android.com/reference/java/util/Map)`<K, V>`                                                                    | ` `[of](https://developer.android.com/reference/java/util/Map#of())`() ` Returns an unmodifiable map containing zero mappings.                                                                                                                                                                                                                                                                                                                                                                  | | ` static <K, V> `[Map](https://developer.android.com/reference/java/util/Map)`<K, V>`                                                                    | ` `[of](https://developer.android.com/reference/java/util/Map#of(K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V))`(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9) ` Returns an unmodifiable map containing nine mappings.                                                                                                                                                                  | | ` static <K, V> `[Map](https://developer.android.com/reference/java/util/Map)`<K, V>`                                                                    | ` `[of](https://developer.android.com/reference/java/util/Map#of(K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V))`(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) ` Returns an unmodifiable map containing six mappings.                                                                                                                                                                                                                                     | | ` static <K, V> `[Map](https://developer.android.com/reference/java/util/Map)`<K, V>`                                                                    | ` `[of](https://developer.android.com/reference/java/util/Map#of(K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V))`(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) ` Returns an unmodifiable map containing seven mappings.                                                                                                                                                                                                             | | ` static <K, V> `[Map](https://developer.android.com/reference/java/util/Map)`<K, V>`                                                                    | ` `[of](https://developer.android.com/reference/java/util/Map#of(K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V))`(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10) ` Returns an unmodifiable map containing ten mappings.                                                                                                                                           | | ` static <K, V> `[Map](https://developer.android.com/reference/java/util/Map)`<K, V>`                                                                    | ` `[ofEntries](https://developer.android.com/reference/java/util/Map#ofEntries(java.util.Map.Entry<?%20extends%20K,?%20extends%20V>[]))`(`[Entry...](https://developer.android.com/reference/java/util/Map.Entry)`<? extends K, ? extends V> entries) ` Returns an unmodifiable map containing keys and values extracted from the given entries.                                                                                                                                                | | ` abstract V`                                                                                                                                            | ` `[put](https://developer.android.com/reference/java/util/Map#put(K,%20V))`(K key, V value) ` Associates the specified value with the specified key in this map (optional operation).                                                                                                                                                                                                                                                                                                          | | ` abstract void`                                                                                                                                         | ` `[putAll](https://developer.android.com/reference/java/util/Map#putAll(java.util.Map<?%20extends%20K,?%20extends%20V>))`(`[Map](https://developer.android.com/reference/java/util/Map)`<? extends K, ? extends V> m) ` Copies all of the mappings from the specified map to this map (optional operation).                                                                                                                                                                                    | | ` default V`                                                                                                                                             | ` `[putIfAbsent](https://developer.android.com/reference/java/util/Map#putIfAbsent(K,%20V))`(K key, V value) ` If the specified key is not already associated with a value (or is mapped to`null`) associates it with the given value and returns`null`, else returns the current value.                                                                                                                                                                                                        | | ` default boolean`                                                                                                                                       | ` `[remove](https://developer.android.com/reference/java/util/Map#remove(java.lang.Object,%20java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` key, `[Object](https://developer.android.com/reference/java/lang/Object)` value) ` Removes the entry for the specified key only if it is currently mapped to the specified value.                                                                                                                         | | ` abstract V`                                                                                                                                            | ` `[remove](https://developer.android.com/reference/java/util/Map#remove(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` key) ` Removes the mapping for a key from this map if it is present (optional operation).                                                                                                                                                                                                                                     | | ` default boolean`                                                                                                                                       | ` `[replace](https://developer.android.com/reference/java/util/Map#replace(K,%20V,%20V))`(K key, V oldValue, V newValue) ` Replaces the entry for the specified key only if currently mapped to the specified value.                                                                                                                                                                                                                                                                            | | ` default V`                                                                                                                                             | ` `[replace](https://developer.android.com/reference/java/util/Map#replace(K,%20V))`(K key, V value) ` Replaces the entry for the specified key only if it is currently mapped to some value.                                                                                                                                                                                                                                                                                                   | | ` default void`                                                                                                                                          | ` `[replaceAll](https://developer.android.com/reference/java/util/Map#replaceAll(java.util.function.BiFunction<?%20super%20K,?%20super%20V,?%20extends%20V>))`(`[BiFunction](https://developer.android.com/reference/java/util/function/BiFunction)`<? super K, ? super V, ? extends V> function) ` Replaces each entry's value with the result of invoking the given function on that entry until all entries have been processed or the function throws an exception.                         | | ` abstract int`                                                                                                                                          | ` `[size](https://developer.android.com/reference/java/util/Map#size())`() ` Returns the number of key-value mappings in this map.                                                                                                                                                                                                                                                                                                                                                              | | ` abstract `[Collection](https://developer.android.com/reference/java/util/Collection)`<V>`                                                              | ` `[values](https://developer.android.com/reference/java/util/Map#values())`() ` Returns a[Collection](https://developer.android.com/reference/java/util/Collection)view of the values contained in this map.                                                                                                                                                                                                                                                                                   | ||
| From interface` `[java.util.SequencedMap](https://developer.android.com/reference/java/util/SequencedMap)` ` |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` default `[Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>`                                                                                   | ` `[firstEntry](https://developer.android.com/reference/java/util/SequencedMap#firstEntry())`() ` Returns the first key-value mapping in this map, or`null`if the map is empty.                                                                                    | | ` default `[Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>`                                                                                   | ` `[lastEntry](https://developer.android.com/reference/java/util/SequencedMap#lastEntry())`() ` Returns the last key-value mapping in this map, or`null`if the map is empty.                                                                                       | | ` default `[Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>`                                                                                   | ` `[pollFirstEntry](https://developer.android.com/reference/java/util/SequencedMap#pollFirstEntry())`() ` Removes and returns the first key-value mapping in this map, or`null`if the map is empty (optional operation).                                           | | ` default `[Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>`                                                                                   | ` `[pollLastEntry](https://developer.android.com/reference/java/util/SequencedMap#pollLastEntry())`() ` Removes and returns the last key-value mapping in this map, or`null`if the map is empty (optional operation).                                              | | ` default V`                                                                                                                                                              | ` `[putFirst](https://developer.android.com/reference/java/util/SequencedMap#putFirst(K,%20V))`(K k, V v) ` Inserts the given mapping into the map if it is not already present, or replaces the value of a mapping if it is already present (optional operation). | | ` default V`                                                                                                                                                              | ` `[putLast](https://developer.android.com/reference/java/util/SequencedMap#putLast(K,%20V))`(K k, V v) ` Inserts the given mapping into the map if it is not already present, or replaces the value of a mapping if it is already present (optional operation).   | | ` abstract `[SequencedMap](https://developer.android.com/reference/java/util/SequencedMap)`<K, V>`                                                                        | ` `[reversed](https://developer.android.com/reference/java/util/SequencedMap#reversed())`() ` Returns a reverse-ordered[view](https://developer.android.com/reference/java/util/Collection#view)of this map.                                                       | | ` default `[SequencedSet](https://developer.android.com/reference/java/util/SequencedSet)`<`[Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>>` | ` `[sequencedEntrySet](https://developer.android.com/reference/java/util/SequencedMap#sequencedEntrySet())`() ` Returns a`SequencedSet`view of this map's[entrySet](https://developer.android.com/reference/java/util/Map#entrySet()).                             | | ` default `[SequencedSet](https://developer.android.com/reference/java/util/SequencedSet)`<K>`                                                                            | ` `[sequencedKeySet](https://developer.android.com/reference/java/util/SequencedMap#sequencedKeySet())`() ` Returns a`SequencedSet`view of this map's[keySet](https://developer.android.com/reference/java/util/Map#keySet()).                                     | | ` default `[SequencedCollection](https://developer.android.com/reference/java/util/SequencedCollection)`<V>`                                                              | ` `[sequencedValues](https://developer.android.com/reference/java/util/SequencedMap#sequencedValues())`() ` Returns a`SequencedCollection`view of this map's[values](https://developer.android.com/reference/java/util/Map#values())collection.                    | ||

## Public methods

### ceilingEntry

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract Entry<K, V> ceilingEntry (K key)
```

Returns a key-value mapping associated with the least key greater than or equal to the given key, or`null`if there is no such key.

<br />

|         Parameters         ||
|-------|---------------------|
| `key` | `K`: the key <br /> |

|                                                                                     Returns                                                                                     ||
|------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
| [Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>` | an entry with the least key greater than or equal to`key`, or`null`if there is no such key <br /> |

|                                                                                   Throws                                                                                   ||
|------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|
| [ClassCastException](https://developer.android.com/reference/java/lang/ClassCastException)     | if the specified key cannot be compared with the keys currently in the map |
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) | if the specified key is null and this map does not permit null keys        |

### ceilingKey

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract K ceilingKey (K key)
```

Returns the least key greater than or equal to the given key, or`null`if there is no such key.

<br />

|         Parameters         ||
|-------|---------------------|
| `key` | `K`: the key <br /> |

|                                         Returns                                          ||
|-----|-------------------------------------------------------------------------------------|
| `K` | the least key greater than or equal to`key`, or`null`if there is no such key <br /> |

|                                                                                   Throws                                                                                   ||
|------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|
| [ClassCastException](https://developer.android.com/reference/java/lang/ClassCastException)     | if the specified key cannot be compared with the keys currently in the map |
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) | if the specified key is null and this map does not permit null keys        |

### descendingKeySet

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract NavigableSet<K> descendingKeySet ()
```

Returns a reverse order[NavigableSet](https://developer.android.com/reference/java/util/NavigableSet)view of the keys contained in this map. The set's iterator returns the keys in descending order. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own`remove`operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the`Iterator.remove`,`Set.remove`,`removeAll`,`retainAll`, and`clear`operations. It does not support the`add`or`addAll`operations.

<br />

|                                                                        Returns                                                                         ||
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| [NavigableSet](https://developer.android.com/reference/java/util/NavigableSet)`<K>` | a reverse order navigable set view of the keys in this map <br /> |

### descendingMap

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract NavigableMap<K, V> descendingMap ()
```

Returns a reverse order view of the mappings contained in this map. The descending map is backed by this map, so changes to the map are reflected in the descending map, and vice-versa. If either map is modified while an iteration over a collection view of either map is in progress (except through the iterator's own`remove`operation), the results of the iteration are undefined.

The returned map has an ordering equivalent to[Collections.reverseOrder](https://developer.android.com/reference/java/util/Collections#reverseOrder(java.util.Comparator<T>))`(comparator())`. The expression`m.descendingMap().descendingMap()`returns a view of`m`essentially equivalent to`m`.

<br />

|                                                             Returns                                                             ||
|----------------------------------------------------------------------------------------|-----------------------------------------|
| [NavigableMap](https://developer.android.com/reference/java/util/NavigableMap)`<K, V>` | a reverse order view of this map <br /> |

### firstEntry

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract Entry<K, V> firstEntry ()
```

Returns a key-value mapping associated with the least key in this map, or`null`if the map is empty.

<br />

|                                                                    Returns                                                                     ||
|------------------------------------------------------------------------------|------------------------------------------------------------------|
| [Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>` | an entry with the least key, or`null`if this map is empty <br /> |

### floorEntry

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract Entry<K, V> floorEntry (K key)
```

Returns a key-value mapping associated with the greatest key less than or equal to the given key, or`null`if there is no such key.

<br />

|         Parameters         ||
|-------|---------------------|
| `key` | `K`: the key <br /> |

|                                                                                     Returns                                                                                     ||
|------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
| [Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>` | an entry with the greatest key less than or equal to`key`, or`null`if there is no such key <br /> |

|                                                                                   Throws                                                                                   ||
|------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|
| [ClassCastException](https://developer.android.com/reference/java/lang/ClassCastException)     | if the specified key cannot be compared with the keys currently in the map |
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) | if the specified key is null and this map does not permit null keys        |

### floorKey

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract K floorKey (K key)
```

Returns the greatest key less than or equal to the given key, or`null`if there is no such key.

<br />

|         Parameters         ||
|-------|---------------------|
| `key` | `K`: the key <br /> |

|                                         Returns                                          ||
|-----|-------------------------------------------------------------------------------------|
| `K` | the greatest key less than or equal to`key`, or`null`if there is no such key <br /> |

|                                                                                   Throws                                                                                   ||
|------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|
| [ClassCastException](https://developer.android.com/reference/java/lang/ClassCastException)     | if the specified key cannot be compared with the keys currently in the map |
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) | if the specified key is null and this map does not permit null keys        |

### headMap

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract SortedMap<K, V> headMap (K toKey)
```

Returns a view of the portion of this map whose keys are strictly less than`toKey`. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an`IllegalArgumentException`on an attempt to insert a key outside its range.

Equivalent to`headMap(toKey, false)`.

<br />

|                                   Parameters                                   ||
|---------|-----------------------------------------------------------------------|
| `toKey` | `K`: high endpoint (exclusive) of the keys in the returned map <br /> |

|                                                                               Returns                                                                               ||
|----------------------------------------------------------------------------------|-----------------------------------------------------------------------------------|
| [SortedMap](https://developer.android.com/reference/java/util/SortedMap)`<K, V>` | a view of the portion of this map whose keys are strictly less than`toKey` <br /> |

|                                                  Throws                                                   ||
|--------------------------------------------------------------------------------------------------------|---|
| [ClassCastException](https://developer.android.com/reference/java/lang/ClassCastException)             |   |
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException)         |   |
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) |   |

### headMap

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract NavigableMap<K, V> headMap (K toKey, 
                boolean inclusive)
```

Returns a view of the portion of this map whose keys are less than (or equal to, if`inclusive`is true)`toKey`. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an`IllegalArgumentException`on an attempt to insert a key outside its range.

<br />

|                                           Parameters                                            ||
|-------------|------------------------------------------------------------------------------------|
| `toKey`     | `K`: high endpoint of the keys in the returned map <br />                          |
| `inclusive` | `boolean`:`true`if the high endpoint is to be included in the returned view <br /> |

|                                                                                               Returns                                                                                                ||
|----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|
| [NavigableMap](https://developer.android.com/reference/java/util/NavigableMap)`<K, V>` | a view of the portion of this map whose keys are less than (or equal to, if`inclusive`is true)`toKey` <br /> |

|                                                                                                                                                                                                                Throws                                                                                                                                                                                                                 ||
|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ClassCastException](https://developer.android.com/reference/java/lang/ClassCastException)             | if`toKey`is not compatible with this map's comparator (or, if the map has no comparator, if`toKey`does not implement[Comparable](https://developer.android.com/reference/java/lang/Comparable)). Implementations may, but are not required to, throw this exception if`toKey`cannot be compared to keys currently in the map. |
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException)         | if`toKey`is null and this map does not permit null keys                                                                                                                                                                                                                                                                       |
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if this map itself has a restricted range, and`toKey`lies outside the bounds of the range                                                                                                                                                                                                                                     |

### higherEntry

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract Entry<K, V> higherEntry (K key)
```

Returns a key-value mapping associated with the least key strictly greater than the given key, or`null`if there is no such key.

<br />

|         Parameters         ||
|-------|---------------------|
| `key` | `K`: the key <br /> |

|                                                                               Returns                                                                               ||
|------------------------------------------------------------------------------|---------------------------------------------------------------------------------------|
| [Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>` | an entry with the least key greater than`key`, or`null`if there is no such key <br /> |

|                                                                                   Throws                                                                                   ||
|------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|
| [ClassCastException](https://developer.android.com/reference/java/lang/ClassCastException)     | if the specified key cannot be compared with the keys currently in the map |
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) | if the specified key is null and this map does not permit null keys        |

### higherKey

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract K higherKey (K key)
```

Returns the least key strictly greater than the given key, or`null`if there is no such key.

<br />

|         Parameters         ||
|-------|---------------------|
| `key` | `K`: the key <br /> |

|                                   Returns                                    ||
|-----|-------------------------------------------------------------------------|
| `K` | the least key greater than`key`, or`null`if there is no such key <br /> |

|                                                                                   Throws                                                                                   ||
|------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|
| [ClassCastException](https://developer.android.com/reference/java/lang/ClassCastException)     | if the specified key cannot be compared with the keys currently in the map |
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) | if the specified key is null and this map does not permit null keys        |

### lastEntry

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract Entry<K, V> lastEntry ()
```

Returns a key-value mapping associated with the greatest key in this map, or`null`if the map is empty.

<br />

|                                                                      Returns                                                                      ||
|------------------------------------------------------------------------------|---------------------------------------------------------------------|
| [Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>` | an entry with the greatest key, or`null`if this map is empty <br /> |

### lowerEntry

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract Entry<K, V> lowerEntry (K key)
```

Returns a key-value mapping associated with the greatest key strictly less than the given key, or`null`if there is no such key.

<br />

|         Parameters         ||
|-------|---------------------|
| `key` | `K`: the key <br /> |

|                                                                               Returns                                                                               ||
|------------------------------------------------------------------------------|---------------------------------------------------------------------------------------|
| [Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>` | an entry with the greatest key less than`key`, or`null`if there is no such key <br /> |

|                                                                                   Throws                                                                                   ||
|------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|
| [ClassCastException](https://developer.android.com/reference/java/lang/ClassCastException)     | if the specified key cannot be compared with the keys currently in the map |
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) | if the specified key is null and this map does not permit null keys        |

### lowerKey

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract K lowerKey (K key)
```

Returns the greatest key strictly less than the given key, or`null`if there is no such key.

<br />

|         Parameters         ||
|-------|---------------------|
| `key` | `K`: the key <br /> |

|                                   Returns                                    ||
|-----|-------------------------------------------------------------------------|
| `K` | the greatest key less than`key`, or`null`if there is no such key <br /> |

|                                                                                   Throws                                                                                   ||
|------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|
| [ClassCastException](https://developer.android.com/reference/java/lang/ClassCastException)     | if the specified key cannot be compared with the keys currently in the map |
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) | if the specified key is null and this map does not permit null keys        |

### navigableKeySet

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract NavigableSet<K> navigableKeySet ()
```

Returns a[NavigableSet](https://developer.android.com/reference/java/util/NavigableSet)view of the keys contained in this map. The set's iterator returns the keys in ascending order. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own`remove`operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the`Iterator.remove`,`Set.remove`,`removeAll`,`retainAll`, and`clear`operations. It does not support the`add`or`addAll`operations.

<br />

|                                                                 Returns                                                                  ||
|-------------------------------------------------------------------------------------|-----------------------------------------------------|
| [NavigableSet](https://developer.android.com/reference/java/util/NavigableSet)`<K>` | a navigable set view of the keys in this map <br /> |

### pollFirstEntry

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract Entry<K, V> pollFirstEntry ()
```

Removes and returns a key-value mapping associated with the least key in this map, or`null`if the map is empty.

<br />

|                                                                        Returns                                                                         ||
|------------------------------------------------------------------------------|--------------------------------------------------------------------------|
| [Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>` | the removed first entry of this map, or`null`if this map is empty <br /> |

### pollLastEntry

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract Entry<K, V> pollLastEntry ()
```

Removes and returns a key-value mapping associated with the greatest key in this map, or`null`if the map is empty.

<br />

|                                                                        Returns                                                                        ||
|------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| [Entry](https://developer.android.com/reference/java/util/Map.Entry)`<K, V>` | the removed last entry of this map, or`null`if this map is empty <br /> |

### reversed

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public NavigableMap<K, V> reversed ()
```

Returns a reverse-ordered[view](https://developer.android.com/reference/java/util/Collection#view)of this map. The encounter order of mappings in the returned view is the inverse of the encounter order of mappings in this map. The reverse ordering affects all order-sensitive operations, including those on the view collections of the returned view. If the implementation permits modifications to this view, the modifications "write through" to the underlying map. Changes to the underlying map might or might not be visible in this reversed view, depending upon the implementation.

This method is equivalent to[descendingMap](https://developer.android.com/reference/java/util/NavigableMap#descendingMap()).

<br />

##### Implementation Requirements:

- The implementation in this interface returns the result of calling the`descendingMap`method.

|                                                                        Returns                                                                        ||
|----------------------------------------------------------------------------------------|---------------------------------------------------------------|
| [NavigableMap](https://developer.android.com/reference/java/util/NavigableMap)`<K, V>` | a reverse-ordered view of this map, as a`NavigableMap` <br /> |

### subMap

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract SortedMap<K, V> subMap (K fromKey, 
                K toKey)
```

Returns a view of the portion of this map whose keys range from`fromKey`, inclusive, to`toKey`, exclusive. (If`fromKey`and`toKey`are equal, the returned map is empty.) The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an`IllegalArgumentException`on an attempt to insert a key outside its range.

Equivalent to`subMap(fromKey, true, toKey, false)`.

<br />

|                                    Parameters                                    ||
|-----------|-----------------------------------------------------------------------|
| `fromKey` | `K`: low endpoint (inclusive) of the keys in the returned map <br />  |
| `toKey`   | `K`: high endpoint (exclusive) of the keys in the returned map <br /> |

|                                                                                          Returns                                                                                           ||
|----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
| [SortedMap](https://developer.android.com/reference/java/util/SortedMap)`<K, V>` | a view of the portion of this map whose keys range from`fromKey`, inclusive, to`toKey`, exclusive <br /> |

|                                                  Throws                                                   ||
|--------------------------------------------------------------------------------------------------------|---|
| [ClassCastException](https://developer.android.com/reference/java/lang/ClassCastException)             |   |
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException)         |   |
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) |   |

### subMap

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract NavigableMap<K, V> subMap (K fromKey, 
                boolean fromInclusive, 
                K toKey, 
                boolean toInclusive)
```

Returns a view of the portion of this map whose keys range from`fromKey`to`toKey`. If`fromKey`and`toKey`are equal, the returned map is empty unless`fromInclusive`and`toInclusive`are both true. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an`IllegalArgumentException`on an attempt to insert a key outside of its range, or to construct a submap either of whose endpoints lie outside its range.

<br />

|                                             Parameters                                              ||
|-----------------|------------------------------------------------------------------------------------|
| `fromKey`       | `K`: low endpoint of the keys in the returned map <br />                           |
| `fromInclusive` | `boolean`:`true`if the low endpoint is to be included in the returned view <br />  |
| `toKey`         | `K`: high endpoint of the keys in the returned map <br />                          |
| `toInclusive`   | `boolean`:`true`if the high endpoint is to be included in the returned view <br /> |

|                                                                                 Returns                                                                                  ||
|----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------|
| [NavigableMap](https://developer.android.com/reference/java/util/NavigableMap)`<K, V>` | a view of the portion of this map whose keys range from`fromKey`to`toKey` <br /> |

|                                                                                                                                                                                             Throws                                                                                                                                                                                             ||
|--------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ClassCastException](https://developer.android.com/reference/java/lang/ClassCastException)             | if`fromKey`and`toKey`cannot be compared to one another using this map's comparator (or, if the map has no comparator, using natural ordering). Implementations may, but are not required to, throw this exception if`fromKey`or`toKey`cannot be compared to keys currently in the map. |
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException)         | if`fromKey`or`toKey`is null and this map does not permit null keys                                                                                                                                                                                                                     |
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if`fromKey`is greater than`toKey`; or if this map itself has a restricted range, and`fromKey`or`toKey`lies outside the bounds of the range                                                                                                                                             |

### tailMap

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract NavigableMap<K, V> tailMap (K fromKey, 
                boolean inclusive)
```

Returns a view of the portion of this map whose keys are greater than (or equal to, if`inclusive`is true)`fromKey`. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an`IllegalArgumentException`on an attempt to insert a key outside its range.

<br />

|                                           Parameters                                           ||
|-------------|-----------------------------------------------------------------------------------|
| `fromKey`   | `K`: low endpoint of the keys in the returned map <br />                          |
| `inclusive` | `boolean`:`true`if the low endpoint is to be included in the returned view <br /> |

|                                                                                                  Returns                                                                                                  ||
|----------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------|
| [NavigableMap](https://developer.android.com/reference/java/util/NavigableMap)`<K, V>` | a view of the portion of this map whose keys are greater than (or equal to, if`inclusive`is true)`fromKey` <br /> |

|                                                                                                                                                                                                                   Throws                                                                                                                                                                                                                    ||
|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ClassCastException](https://developer.android.com/reference/java/lang/ClassCastException)             | if`fromKey`is not compatible with this map's comparator (or, if the map has no comparator, if`fromKey`does not implement[Comparable](https://developer.android.com/reference/java/lang/Comparable)). Implementations may, but are not required to, throw this exception if`fromKey`cannot be compared to keys currently in the map. |
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException)         | if`fromKey`is null and this map does not permit null keys                                                                                                                                                                                                                                                                           |
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if this map itself has a restricted range, and`fromKey`lies outside the bounds of the range                                                                                                                                                                                                                                         |

### tailMap

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract SortedMap<K, V> tailMap (K fromKey)
```

Returns a view of the portion of this map whose keys are greater than or equal to`fromKey`. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an`IllegalArgumentException`on an attempt to insert a key outside its range.

Equivalent to`tailMap(fromKey, true)`.

<br />

|                                   Parameters                                    ||
|-----------|----------------------------------------------------------------------|
| `fromKey` | `K`: low endpoint (inclusive) of the keys in the returned map <br /> |

|                                                                                   Returns                                                                                   ||
|----------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|
| [SortedMap](https://developer.android.com/reference/java/util/SortedMap)`<K, V>` | a view of the portion of this map whose keys are greater than or equal to`fromKey` <br /> |

|                                                  Throws                                                   ||
|--------------------------------------------------------------------------------------------------------|---|
| [ClassCastException](https://developer.android.com/reference/java/lang/ClassCastException)             |   |
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException)         |   |
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) |   |