Iterator and Iterable

suggest change

Versions

Iterator has been in Java SE since 1.2. Iterable was added in Java 5. The original version list ran from Java SE 1.2 through Java SE 9 Early Access.

Introduction

java.util.Iterator is the standard Java SE interface for objects that implement the Iterator design pattern. java.lang.Iterable is for objects that can provide an iterator.

Remarks

It is possible to iterate over an array using the for-each loop, though Java arrays do not implement Iterable. The compiler turns that loop into an index loop.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents