Iterable Interface

Package: java.util

The Iterable interface must be implemented by any class that can be used by Java’s enhanced for statement (commonly called “foreach”).

This interface defines a single method named iterator, which returns an object that implements the Iterator interface. For more information, see Iterator Interface.

Method

Method

Explanation

Iterator iterator()

Returns an Iterator object that can be used to iterate the object.

Get Java For Dummies Quick Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.