SortedSet是个接口,它里面的(只有TreeSet这一个实现可用)中的元素一定是有序的。
声明的主要接口
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract Comparator<? super E> |
comparator()
Returns the comparator used to compare elements in this
SortedSet .
返回与此有序集合关联的比较器,如果使用元素的自然顺序,则返回 null。
| ||||||||||
abstract E |
first()
Returns the first 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.
用一个SortedSet, 返回此有序集合中小于end的所有元素。
| ||||||||||
abstract E |
last()
Returns the last 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.
返回此有序集合的部分元素,元素范围从 fromElement(包括)到 toElement(
不包括)。
| ||||||||||
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.
返回此有序集合的部分元素,其元素
大于或等于 fromElement。
|
2
3:关于SortedSe截取子串的时候,to都不包含,from包含