import java.util.Iterator; import java.util.Random; public class IteratorTesting { public static void main(String[] args) { int [] stuff = {1, 2, 3, 10, 0, 15}; for (int i : stuff) { System.out.print(i + ", "); } GenericList list = new GenericList(); Random rand = new Random(); for (int i = 0; i < 5; i++) { list.insert(rand.nextInt(10)); } //one way to iterate through the elements. Iterator iter = list.iterator(); while(iter.hasNext()) { System.out.print(iter.next() + ", "); } //another way to iterate through System.out.println("\nHere's another printout:"); for (Integer i : list) { System.out.print(i + ": "); } } }