πŸ“Š JAVA
Q. What is the purpose of the reduce() method in a stream pipeline?
  • (A) To transform a stream into a new stream
  • (B) To terminate the stream and return a single result
  • (C) To filter the stream elements
  • (D) To perform a side-effect on the stream elements
πŸ’¬ Discuss
βœ… Correct Answer: (B) To terminate the stream and return a single result

Explanation: The reduce() method combines the elements of a stream into a single result using a specified binary operator.

Explanation by: Pushkar
The reduce() method combines the elements of a stream into a single result using a specified binary operator.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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