java collection framework

这个接口是所有collection框架的基础接口,先看接口定义:

Implementing this interface allows an object to be the target of the “for-each loop” statement. See For-each Loop.

首先这是一个规范性的接口,当程序员对象或者collection可以运用for-each方式遍历的时候需要实现这个接口.

1
Iterator<T> iterator(); 返回foreach语句提供的迭代器