java 8 foreach lambda code example Example: inline foreach java names.forEach(name -> System.out.println(name));