Q. 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
πŸ’¬ Discuss
βœ… Correct 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.
Explanation by: Pushkar
The peek() method allows you to perform a side-effect on each element of the stream without modifying the stream itself.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
269
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Pushkar
Publisher
πŸ“ˆ
89%
Success Rate