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
TreeSet<E> |
TreeSet is an implementation of SortedSet. |
Summary
Public Methods
add,
addAll,
clear,
contains,
containsAll,
equals,
hashCode,
isEmpty,
iterator,
remove,
removeAll,
retainAll,
size,
toArray,
toArray
Methods inherited
from interface
java.util.Set
add,
addAll,
clear,
contains,
containsAll,
equals,
hashCode,
isEmpty,
iterator,
remove,
removeAll,
retainAll,
size,
toArray,
toArray
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.
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.
Returns
- a subset where the elements are less than
end
public
E
last()
Answer the last sorted element in this SortedSet.
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
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.
Returns
- a subset where the elements are greater or equal to
start