list.foreach java code example
Example 1: java foreach list
list.forEach((MyType myObject) -> {/* code */});
Example 2: foreach java
for (String name : names) {
System.out.println(name);
}
Example 3: java foreach
List<String> someList = new ArrayList<String>();
// add "monkey", "donkey", "skeleton key" to someList
for (String item : someList) {
System.out.println(item);
}