Java中SortedSet

 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。
注意: 1 :SortedSet意思是“根据对象的比较顺序”,而不是“插入顺序”进行排序.
          2 :关于SortedSet的更多信息请参阅下面的它唯一实现类TreeSet。

          3:关于SortedSe截取子串的时候,to都不包含,from包含


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值