Iterable
概述
Implementing this interface allows an object to be the target of the "for-each loop" statement.
实现Iterable接口 允许一个对象 作为 foreach遍历的目标;
public interface Iterable<T> { Iterator<T> iterator(); }
Iterator
概述
An iterator over a collection.
{@code Iterator} takes the place of {@link Enumeration} in the Java Collections Framework.
Collection的iterator;
Iterator替代了Java集合框架的Enumeration;
public interface Iterator<E> { boolean hasNext(); E next(); default void remove() { throw new UnsupportedOperationException("remove"); } }
Collection
概述
The root interface in the <i>collection hierarchy</i>.
A collection represents a group of objects, known as its <i>elements</i>.
Some collections allow duplicate elements and others do not.
Some are ordered and others unordered.
The JDK does not provide any <i>direct</i> implementations of this interface: it provides implementations of more specific subinterfaces like <tt>Set</tt> and <tt>List</tt>.
This interface is typically used to pass collections around and manipulate them where maximum generality is desired.
集合的root接口;
collection代表一组对象,称对象为元素;
jdk没有提供直接的collection的实现,提供了子接口:Set、List;
public interface Collection<E> extends Iterable<E> { }