foreach in java 8 example
Example 1: foreach java
for (String name : names) {
System.out.println(name);
}
Example 2: java foreach
List<String> someList = new ArrayList<String>();
// add "monkey", "donkey", "skeleton key" to someList
for (String item : someList) {
System.out.println(item);
}