The for-each
loop is used with both collections and arrays. It's intended to simplify
the most common form of iteration, where the iterator or index is used
solely for iteration, and not for any other kind of operation, such as
removing or editing an item in the collection or array. When there is a
choice, the for-each loop should be preferred over the for
loop, since it increases legibility.