前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >java中sortedset_Java中SortedSet

java中sortedset_Java中SortedSet

作者头像
用户7886150
修改2021-04-26 17:42:33
1.2K0
修改2021-04-26 17:42:33
举报
文章被收录于专栏:bit哲学院bit哲学院

参考链接: 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

 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

 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

 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包含

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档