public interface

NavigableMap

implements SortedMap<K, V>
java.util.NavigableMap<K, V>
Known Indirect Subclasses

Class Overview

NavigableMap is a SortedMap with navigation methods answering the closest matches for specified item.

Summary

Public Methods
abstract Entry<K, V> ceilingEntry(K key)
Returns an entry related with the smallest key greater than or equal to the specified key, or null if no such key.
abstract K ceilingKey(K key)
Returns the smallest key greater than or equal to the specified key, or null if no such key.
abstract NavigableSet<K> descendingKeySet()
Returns a NavigableSet view of the keys in descending order.
abstract NavigableMap<K, V> descendingMap()
Returns a reverse order view of the map.
abstract Entry<K, V> firstEntry()
Returns the entry with the smallest key, or null if the map is empty.
abstract Entry<K, V> floorEntry(K key)
Returns an entry related with the biggest key less than or equal to the specified key, or null if no such key.
abstract K floorKey(K key)
Returns the biggest key less than or equal to the specified key, or null if no such key.
abstract NavigableMap<K, V> headMap(K endKey, boolean inclusive)
Returns a view of the head of the map whose keys are smaller than (or equal to, depends on inclusive argument) endKey.
abstract Entry<K, V> higherEntry(K key)
Returns an entry related with the smallest key greater than the specified key, or null if no such key.
abstract K higherKey(K key)
Returns the smallest key greater than the specified key, or null if no such key.
abstract Entry<K, V> lastEntry()
Returns the entry with the biggest key, or null if the map is empty.
abstract Entry<K, V> lowerEntry(K key)
Returns an entry related with the biggest key less than the specified key, or null if no such key.
abstract K lowerKey(K key)
Returns the biggest key less than the specified key, or null if no such key.
abstract NavigableSet<K> navigableKeySet()
Returns a NavigableSet view of the keys in ascending order.
abstract Entry<K, V> pollFirstEntry()
Deletes and returns the entry with the smallest key, or null if the map is empty.
abstract Entry<K, V> pollLastEntry()
Deletes and returns the entry with the biggest key, or null if the map is empty.
abstract NavigableMap<K, V> subMap(K startKey, boolean startInclusive, K endKey, boolean endInclusive)
Returns a view of part of the map whose keys is from startKey to endKey.
abstract NavigableMap<K, V> tailMap(K startKey, boolean inclusive)
Returns a view of the tail of the map whose keys are bigger than (or equal to, depends on inclusive argument) startKey.
[Expand]
Inherited Methods
From interface java.util.Map
From interface java.util.SortedMap

Public Methods

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

Since: API Level 9

Returns an entry related with the smallest key greater than or equal to the specified key, or null if no such key.

Parameters
key the key
Returns
  • the entry, or null if no such key
Throws
ClassCastException if the key cannot be compared with the keys in the map
NullPointerException if the key is null and the map can not contain null key

public abstract K ceilingKey (K key)

Since: API Level 9

Returns the smallest key greater than or equal to the specified key, or null if no such key.

Parameters
key the key
Returns
  • the smallest key greater than or equal to key, or null if no such key
Throws
ClassCastException if the key cannot be compared with the keys in the map
NullPointerException if the key is null and the map can not contain null key

public abstract NavigableSet<K> descendingKeySet ()

Since: API Level 9

Returns a NavigableSet view of the keys in descending order.

Returns
  • the navigable set view

public abstract NavigableMap<K, V> descendingMap ()

Since: API Level 9

Returns a reverse order view of the map.

Returns
  • the reverse order view of the map

public abstract Entry<K, V> firstEntry ()

Since: API Level 9

Returns the entry with the smallest key, or null if the map is empty.

Returns
  • the entry with the smallest key, or null if the map is empty

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

Since: API Level 9

Returns an entry related with the biggest key less than or equal to the specified key, or null if no such key.

Parameters
key the key
Returns
  • the entry, or null if no such key
Throws
ClassCastException if the key cannot be compared with the keys in the map
NullPointerException if the key is null and the map can not contain null key

public abstract K floorKey (K key)

Since: API Level 9

Returns the biggest key less than or equal to the specified key, or null if no such key.

Parameters
key the key
Returns
  • the biggest key less than or equal to key, or null if no such key
Throws
ClassCastException if the key cannot be compared with the keys in the map
NullPointerException if the key is null and the map can not contain null key

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

Since: API Level 9

Returns a view of the head of the map whose keys are smaller than (or equal to, depends on inclusive argument) endKey.

Parameters
endKey the end key
inclusive true if the end key is in the returned map
Returns
  • the head-map view
Throws
ClassCastException when the class of the end key is inappropriate for this SubMap
NullPointerException when the end key is null and this SortedMap does not support null keys
IllegalArgumentException when the map is range-limited and end key is out of the range of the map

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

Since: API Level 9

Returns an entry related with the smallest key greater than the specified key, or null if no such key.

Parameters
key the key
Returns
  • the entry, or null if no such key
Throws
ClassCastException if the key cannot be compared with the keys in the map
NullPointerException if the key is null and the map can not contain null key

public abstract K higherKey (K key)

Since: API Level 9

Returns the smallest key greater than the specified key, or null if no such key.

Parameters
key the key
Returns
  • the smallest key greater than key, or null if no such key
Throws
ClassCastException if the key cannot be compared with the keys in the map
NullPointerException if the key is null and the map can not contain null key

public abstract Entry<K, V> lastEntry ()

Since: API Level 9

Returns the entry with the biggest key, or null if the map is empty.

Returns
  • the entry with the biggest key, or null if the map is empty

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

Since: API Level 9

Returns an entry related with the biggest key less than the specified key, or null if no such key.

Parameters
key the key
Returns
  • the entry, or null if no such key
Throws
ClassCastException if the key cannot be compared with the keys in the map
NullPointerException if the key is null and the map can not contain null key

public abstract K lowerKey (K key)

Since: API Level 9

Returns the biggest key less than the specified key, or null if no such key.

Parameters
key the key
Returns
  • the biggest key less than key, or null if no such key
Throws
ClassCastException if the key cannot be compared with the keys in the map
NullPointerException if the key is null and the map can not contain null key

public abstract NavigableSet<K> navigableKeySet ()

Since: API Level 9

Returns a NavigableSet view of the keys in ascending order.

Returns
  • the navigable set view

public abstract Entry<K, V> pollFirstEntry ()

Since: API Level 9

Deletes and returns the entry with the smallest key, or null if the map is empty.

Returns
  • the entry with the smallest key, or null if the map is empty

public abstract Entry<K, V> pollLastEntry ()

Since: API Level 9

Deletes and returns the entry with the biggest key, or null if the map is empty.

Returns
  • the entry with the biggest key, or null if the map is empty

public abstract NavigableMap<K, V> subMap (K startKey, boolean startInclusive, K endKey, boolean endInclusive)

Since: API Level 9

Returns a view of part of the map whose keys is from startKey to endKey.

Parameters
startKey the start key
startInclusive true if the start key is in the returned map
endKey the end key
endInclusive true if the end key is in the returned map
Returns
  • the sub-map view
Throws
ClassCastException when the class of the start or end key is inappropriate for this SubMap
NullPointerException when the start or end key is null and this SortedMap does not support null keys
IllegalArgumentException when the start key is greater than the end key

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

Since: API Level 9

Returns a view of the tail of the map whose keys are bigger than (or equal to, depends on inclusive argument) startKey.

Parameters
startKey the start key
inclusive true if the start key is in the returned map
Returns
  • the tail-map view
Throws
ClassCastException when the class of the start key is inappropriate for this SubMap
NullPointerException when the start key is null and this SortedMap does not support null keys
IllegalArgumentException when the map is range-limited and start key is out of the range of the map