0 votes
in JAVA by
Which of the following is true about the reduce() method in Java 8?

a) It is used to perform a side-effect on each element of the stream.

b) It is used to transform each element of the stream into a new element.

c) It is used to terminate the stream and return a single result.

d) It is used to filter the stream elements.

1 Answer

0 votes
by

Answer: c) It is used to terminate the stream and return a single result.

Explanation: The reduce() method allows you to reduce a stream of elements into a single result, using a binary operator. For example, you can use reduce() to find the sum or maximum value of a stream of integers.

Related questions

0 votes
asked Apr 30 in JAVA by john ganales
0 votes
asked Apr 30 in JAVA by john ganales
...