// I T E R A T O R , with generics

import java.util.Iterator;
import java.util.ArrayList;

//...

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 value : a )
   {
   // display each vegetable
   System.out.println( value );
   }