Run »
import java.util.ArrayList; import java.util.function.Consumer; public class Main { public static void main(String[] args) { ArrayList
numbers = new ArrayList
(); numbers.add(5); numbers.add(9); numbers.add(8); numbers.add(1); Consumer
method = (n) -> { System.out.println(n); }; numbers.forEach( method ); } }
5
9
8
1