ArrayList<String> data = new ArrayList<String>(); data.add("hello"); data.add("goodbye"); // data.add(new Date()); This won't compile! Iterator<String> it = data.iterator(); while (it.hasNext()) { String s = it.next(); System.out.println(s); }