for each item in a list java code example Example: java foreach list list.forEach((MyType myObject) -> {/* code */});