0 votes
in JAVA by

 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

1 Answer

0 votes
by
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.
...