java 控制 sortedset_关于SortedSet界面,java教程

阅读this Oracle教程我偶然发现了List的范围视图操作与SortedSet接口提供的操作之间差异的解释.

这有点兴趣:

The range-view operations are somewhat analogous to those provided by

the List interface, but there is one big difference. Range views of a

sorted set remain valid even if the backing sorted set is modified

directly. This is feasible because the endpoints of a range view of a

sorted set are absolute points in the element space rather than

specific elements in the backing collection, as is the case for lists.

是否有人能够用其他词语解释大胆的部分?

提前致谢.

解决方法:

假设你有一个列表和一个包含整数11,13,15和17的集合.

您可以编写set.subSet(12,15)来构造视图,然后将12插入到原始集中.如果这样做,12将出现在视图中.

列表无法实现这一点.即使您可以构造视图,在结构上修改原始列表的那一刻(例如插入元素),视图也会变得无效.

标签:java,sortedset,list

来源: https://codeday.me/bug/20190529/1178879.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值