Prior to Java 8, you need to use the following:
Iterator<String> iterator = someList.iterator();while (iterator.hasNext()) { String item = iterator.next(); System.out.println(item);}
However, with the introduction of Streams in Java 8 you can do same thing in much less syntax. For example, for your someList
you can do:
someList.stream().forEach(System.out::println);
You can find more about streams here.