问题描述
为仅为
枚举
但不为为
(或 java.util.Collections.list
Iterator Iterable
)?或者为什么 Iterator
(或 Iterable
)没有这个函数的重载?有没有其他方法这样做?是否有什么原因?
Why is java.util.Collections.list
only for Enumeration
but not for Iterator
(or Iterable
)? Or why is there not an overload of this function for Iterator
(or Iterable
)? Is there any other method which does that? Is there any reason why that is?
推荐答案
没有人真的回答了,所以这里我去:
Noone really answered it yet, so here I go:
当它被引入时,可能没有 Iterable
。现在,它已经过时了( Collection
实现的构造函数提供了相同的东西),只保留向后兼容。
When it what introduced, there probably was no Iterable
yet. Now, it is obsolete (constructors of most Collection
implementations provide the same thing) and just stays there for backward compatibility.
这篇关于Java:iterator / iterable的Collections.list的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!