Home / Programming MCQs / JAVA MCQs / Question

P

Pushkar • 380 Points
Valuable

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

Explanation:

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

You must be Logged in to update hint/solution

Discusssion

Login to discuss.