Take the 2-minute tour ×  Iterable<E> is in java.lang whereas
Iterator<E> is in java.util. Is there a good reason for this or
is this merely an artifact of bad design?  It seems strange
since the only thing that an Iterable<E> is good for is
providing an Iterator<E>.  EDIT: One potential reason is because
of the (then-)newly introduced for-each loop. I guess my
question then would be, are they equivalent?  for(Object o :
collection)     o = iter.next();  If they are, then that still
doesn't explain why the two classes are in different packages
since the compiler would have to import java.util anyways to use
the Iterator construct.  share|improve this question I think if
they could do everything from scratch, Iterator would be in
java.lang together with Iterable. But as duffymo said, it was in
util since 1.2, and you can't really compatibly move a
class/interface to another location. –  Paŭlo Ebermann Aug 2 '11
at 2:00 @Paulo, they could have, if they wanted to: interface
java.lang.Iterator2; interface java.ut