- peek operation on stream returns a stream similar to the original stream, while applying a Consumer function to each item in the stream.
int stream one to three
Stream<Integer> oneToThree = Stream.of(1, 2, 3);
Stream<Integer> oneToThree_peeked = oneToThree.peek(i -> log.info(i.toString()));
log.info("triggering stream processing with a terminal action");