为什么在java.util.Collection上有一个方法iterator() [英] Why is there a method iterator() on java.util.Collection

查看:161
本文介绍了为什么在java.util.Collection上有一个方法iterator()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么在java.util.Collection接口上定义方法iterator(),它已经扩展了定义了这个方法的java.util.Iterable。

Why is there the method iterator() defined on the interface java.util.Collection when it already extends java.util.Iterable which has this very method defined.

任何其他的想法?

推荐答案

我一直在做一些更多的调查,发现equals()和hashcode()方法也被覆盖。

I have been doing some more investigation on this and have found that the equals() and hashcode() methods are also overwritten.

显然,唯一的原因可能是添加javadoc - 也许这就是为什么iterator()也被覆盖。

Clearly the only reason for this can be to add the javadoc - maybe this is why iterator() was also overwritten.

这篇关于为什么在java.util.Collection上有一个方法iterator()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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