List<String> list = List.of("a", "b", "c"); list.forEach(elt -> System.out.println(elt)) /* output: a b c */