I started working with streams and facing below issue:
ArrayList<Integer> al = new ArrayList<Integer>();
al.add(10);
al.add(20);
al.add(30);
al.stream().forEach(System.out::println); // This works
al.stream().map(System.out::println); // This fails with error as "Incompatible types: expected not void but compile-time declaration for method reference has void return type"
Can someone please explain this?