gpt4 book ai didi

java - 关于SortedSet接口(interface),java教程

转载 作者:搜寻专家 更新时间:2023-11-01 02:12:30 25 4
gpt4 key购买 nike

阅读 this Oracle 教程我遇到了关于 List 的范围 View 操作与 SortedSet 接口(interface)提供的范围 View 操作之间差异的解释。

这里是感兴趣的地方:

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.

是否有人能够用比方说其他词来解释粗体部分?

提前致谢。

最佳答案

假设您有一个列表和一个集合,它们都包含整数 11131517.

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

这对于列表是不可能的。即使您可以构造一个 View ,但一旦您在结构上修改原始列表(例如插入一个元素),该 View 就会失效。

关于java - 关于SortedSet接口(interface),java教程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15789616/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com