Android
java.util
public interface

java.util.SortedSet<E>

java.util.SortedSet<E> Set<E>

SortedSet is a Set which iterates its elements in sorted order.

Known Indirect Subclasses

Summary

Public Methods

          Comparator<? super E>  comparator()
Returns the Comparator used to compare elements in this SortedSet.
          first()
Answer the first sorted element in this SortedSet.
          SortedSet<E>  headSet(E end)
Returns a SortedSet of the specified portion of this SortedSet which contains elements less than the end element.
          last()
Answer the last sorted element in this SortedSet.
          SortedSet<E>  subSet(E start, E end)
Returns a SortedSet of the specified portion of this SortedSet which contains elements greater or equal to the start element but less than the end element.
          SortedSet<E>  tailSet(E start)
Returns a SortedSet of the specified portion of this SortedSet which contains elements greater or equal to the start element.
Methods inherited from interface java.lang.Iterable
Methods inherited from interface java.util.Collection
Methods inherited from interface java.util.Set

Details

Public Methods

public Comparator<? super E> comparator()

Returns the Comparator used to compare elements in this SortedSet.

Returns

  • a Comparator or null if the natural order is used

public E first()

Answer the first sorted element in this SortedSet.

Returns

  • the first sorted element

Throws

NoSuchElementException when this SortedSet is empty

public SortedSet<E> headSet(E end)

Returns a SortedSet of the specified portion of this SortedSet which contains elements less than the end element. The returned SortedSet is backed by this SortedSet so changes to one are reflected by the other.

Parameters

end the end element

Returns

  • a subset where the elements are less than end

Throws

ClassCastException when the class of the end element is inappropriate for this SubSet
NullPointerException when the end element is null and this SortedSet does not support null elements

public E last()

Answer the last sorted element in this SortedSet.

Returns

  • the last sorted element

Throws

NoSuchElementException when this SortedSet is empty

public SortedSet<E> subSet(E start, E end)

Returns a SortedSet of the specified portion of this SortedSet which contains elements greater or equal to the start element but less than the end element. The returned SortedSet is backed by this SortedMap so changes to one are reflected by the other.

Parameters

start the start element
end the end element

Returns

  • a subset where the elements are greater or equal to start and less than end

Throws

ClassCastException when the class of the start or end element is inappropriate for this SubSet
NullPointerException when the start or end element is null and this SortedSet does not support null elements
IllegalArgumentException when the start element is greater than the end element

public SortedSet<E> tailSet(E start)

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

Parameters

start the start element

Returns

  • a subset where the elements are greater or equal to start

Throws

ClassCastException when the class of the start element is inappropriate for this SubSet
NullPointerException when the start element is null and this SortedSet does not support null elements
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:48