Iterator and Iterable
Interfaces
The Java standard libraries have two interfaces that have very similar
names: Iterator and Iterable (or we could use their
full names, java.util.Iterator
and java.lang.Iterable).
The short explanation is that an iterator allows one to visit (iterate over) each item in a collection, whereas a class marked iterable is able to provide one with an iterator for instances of the class.
In order to implement the Iterator interface, a class must
provide hasNext(), next(), and remove()
methods. These are used to iterate over the collection, detect the end of items
to iterate over, etc.
In order to implement the Iterable interface, a class must
provide an iterator() method which returns an iterator over all the
items stored within an object of that class.
For details, see the API docs:
From here one can go