gpt4 book ai didi

java - 为什么 Iterator iterator() 已经在 Iterable 中,却被放入 Collection、AbstractCollection 中

转载 作者:行者123 更新时间:2023-12-01 18:42:50 25 4
gpt4 key购买 nike

当迭代器 iterator()放入 Iterable接口(interface),并由 Collection 扩展接口(interface)和AbstractCollection接口(interface),为什么Collection又提到了这个/AbstractCollection因为抽象类中没有对此给出定义。

请帮助我从设计角度理解我在此缺少什么

最佳答案

由于 Javadoc 不同,iterator() 出现在 Iterator 和 Collection 中。在 AbstractCollection 中,它又有所不同,但似乎没有增加太多值(value)。

关于java - 为什么 Iterator<E> iterator() 已经在 Iterable 中,却被放入 Collection、AbstractCollection 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19211859/

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