import java.util.*;
import java.util.function.Consumer;

class Stream1 {
	public static void main(String[] args) {

		ArrayList<Integer> list = new ArrayList<>();
		for(int i = 0; i < 10; i++) {
			list.add((int) (Math.random() * 100));
		}

		list.stream().forEach(new MyConsumer());
		System.out.println();

		list.stream().forEach(new Consumer<Integer>() {
			public void accept(Integer e) {
				System.out.print(e + " ");
			}
		});
		System.out.println();

		list.stream().forEach((e) -> {
			System.out.print(e + " ");
		});
		System.out.println();

		list.stream().forEach(e -> System.out.print(e + " "));
		System.out.println();
	
		list.stream().forEach(Stream1::print);
		System.out.println();

	}

	public static void print(Integer e) {
		System.out.print(e + " ");
	}



} // End of Stream1 

class MyConsumer implements Consumer<Integer> {
	public void accept(Integer e) {
		System.out.print(e + " ");
	}
}
