Tuesday, September 9, 2008

Behind scenes of enhanced for loop

The for-each loop can be used with identifiers whose type is Iterable or its an Array type.
From JLS

The Expression must either have type Iterable or else it must be of an array type (§10.1), or a compile-time error occurs.


Now that following in the java.lang.Iterable javadoc

All Known Subinterfaces:
BeanContext, BeanContextServices, BlockingQueue, Collection, List, Queue, Set, SortedSet

No comments: