加载中...
The Wayback Machine - https://sup1a9wrlpyh5li9ro.vcoronado.top/web/20090218195228/http://developer.android.com:80/reference/java/util/SortedSet.html
public interface

SortedSet

implements Set<E>
java.util.SortedSet<E>
Known Indirect Subclasses

Class Overview

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

Summary

Public Methods
abstract Comparator<? super E> comparator()
Returns the Comparator used to compare elements in this SortedSet.
abstract E first()
Answer the first sorted element in this SortedSet.
abstract SortedSet<E> headSet(E end)
Returns a SortedSet of the specified portion of this SortedSet which contains elements less than the end element.
abstract E last()
Answer the last sorted element in this SortedSet.
abstract 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.
abstract 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.
[Expand]
Inherited Methods
From interface java.lang.Iterable
From interface java.util.Collection
From interface java.util.Set

Public Methods

public abstract 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 abstract E first ()

Answer the first sorted element in this SortedSet.

Returns
  • the first sorted element
Throws
NoSuchElementException when this SortedSet is empty

public abstract 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 abstract E last ()

Answer the last sorted element in this SortedSet.

Returns
  • the last sorted element
Throws
NoSuchElementException when this SortedSet is empty

public abstract 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 abstract 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