What is the purpose of the peek() method in a stream pipeline?
a) To modify the stream elements
b) To inspect the stream elements
c) To terminate the stream
d) To filter the stream elements
Answer: b) To inspect the stream elements.
Explanation: The peek() method allows you to perform a side-effect on each element of the stream without modifying the stream itself.