public interface SortedSet<E> extends Set<E>
Comparator which is passed into a concrete implementation at
construction time. All elements in this set must be mutually comparable. The
ordering in this set must be consistent with equals of its elements.Comparator,
Comparable| Modifier and Type | Method and Description |
|---|---|
Comparator<? super E> |
comparator()
Returns the comparator used to compare elements in this
SortedSet. |
E |
first()
Returns the first 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. |
E |
last()
Returns the last 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. |
Comparator<? super E> comparator()
SortedSet.E first()
SortedSet. The first element
is the lowest element.NoSuchElementException - when this SortedSet is empty.SortedSet<E> headSet(E end)
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 set are reflected by the other.end - the end element.end.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.E last()
SortedSet. The last element is
the highest element.NoSuchElementException - when this SortedSet is empty.SortedSet<E> subSet(E start, E end)
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 set are reflected by the
other.start - the start element.end - the end element.start
and less than end.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.SortedSet<E> tailSet(E start)
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 set are reflected by the other.start - the start element.start .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.