Java:iterator / iterable的Collections.list [英] Java: Collections.list for iterator / iterable

查看:147
本文介绍了Java:iterator / iterable的Collections.list的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

仅为枚举但不为 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆