theList.forEach(System.put::println) in java code example Example: inline foreach java names.forEach(name -> System.out.println(name));