Android
java.util
public interface

java.util.SortedMap<K, V>

java.util.SortedMap<K, V> Map<K, V>

SortedMap is a Map where the iterators sequence in order of the sorted keys.

Known Indirect Subclasses

Summary

Public Methods

          Comparator<? super K>  comparator()
Returns the Comparator used to compare elements in this SortedMap.
          firstKey()
Answer the first sorted key in this SortedMap.
          SortedMap<K, V>  headMap(K endKey)
Returns a SortedMap of the specified portion of this SortedMap which contains keys less than the end key.
          lastKey()
Returns the last sorted key in this SortedMap.
          SortedMap<K, V>  subMap(K startKey, K endKey)
Returns a SortedMap of the specified portion of this SortedMap which contains keys greater or equal to the start key but less than the end key.
          SortedMap<K, V>  tailMap(K startKey)
Returns a SortedMap of the specified portion of this SortedMap which contains keys greater or equal to the start key.
Methods inherited from interface java.util.Map

Details

Public Methods

public Comparator<? super K> comparator()

Returns the Comparator used to compare elements in this SortedMap.

Returns

  • a Comparator or null if the natural order is used

public K firstKey()

Answer the first sorted key in this SortedMap.

Returns

  • the first sorted key

Throws

NoSuchElementException when this SortedMap is empty

public SortedMap<K, V> headMap(K endKey)

Returns a SortedMap of the specified portion of this SortedMap which contains keys less than the end key. Users should be aware that the return value is actually backed by this SortedMap. Hence any modifications made to one will be immediately visible to the other.

Parameters

endKey the end key

Returns

  • a submap where the keys are less than endKey

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

public K lastKey()

Returns the last sorted key in this SortedMap.

Returns

  • the last sorted key

Throws

NoSuchElementException when this SortedMap is empty

public SortedMap<K, V> subMap(K startKey, K endKey)

Returns a SortedMap of the specified portion of this SortedMap which contains keys greater or equal to the start key but less than the end key. Users should be aware that the return value is actually backed by this SortedMap. Hence any modifications made to one will be immediately visible to the other.

Parameters

startKey the start key
endKey the end key

Returns

  • a submap where the keys are greater or equal to startKey and less than endKey

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 SortedMap<K, V> tailMap(K startKey)

Returns a SortedMap of the specified portion of this SortedMap which contains keys greater or equal to the start key. The returned SortedMap is backed by this SortedMap so changes to one are reflected by the other.

Parameters

startKey the start key

Returns

  • a submap where the keys are greater or equal to startKey

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
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:48