首页 > 编程知识 正文

javagetset方法调用,java set方法

时间:2023-05-03 16:36:57 阅读:18743 作者:180

阅读this Oracle教程,偶然发现了List范围查看操作与SortedSet界面提供的操作之间的区别。

我对这个有点感兴趣:

the range-viewoperationsaresomewhatanalogoustothoseprovidedby

the List interface,butthereisonebigdifference.rangeviewsofa

sortedsetremainvalidevenifthebackingsortedsetismodified

directly.thisisfeasiblebecausetheendpointsofarangeviewofa

sortedsetareabsolutepointsintheelementspaceratherthan

specificelementsinthebackingcollection,as is the case for lists。

有人能用其他语言说明大胆的部分吗?

提前表示感谢。

解决方法:

假设有一个包含列表和整数11、13、15和17的集合。

可以编写set.subset (12,15 )构建视图,并将12插入到原始集中。 这样,视图中将显示12。

名单无法做到这一点。 即使可以构建视图,也会在结构上更改原始列表(如插入元素)时禁用视图。

标签: java、sortedset、list

资料来源: https://codeday.me/bug/2019 05 29/1178879.html

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。