// I T E R A T O R , with generics import java.util.Iterator; import java.util.ArrayList; import static java.lang.System.out; //... ArrayList<String> a = new ArrayList<String>( 100 ); a.add( "broccoli" ); a.add( "cauliflower" ); a.add( "carrots" ); a.add( "peas" ); // Note how with for:each you specify the Iterable Collection, // not the a.iterator() Iterator it generates. for ( String vegetable : a ) { // display each vegetable out.println( vegetable ); }