HashMap<Long, Double> map = new HashMap<>();
// here init map, add some values there
// with 'foreach' all elements are printed
map.entrySet().stream().foreach(System.out::println);
// but when I use 'peek' nothing happens
map.entrySet().stream().peek(System.out::println);
My question is: why peek
does not iterate all elements from the stream?