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

a) It returns a new stream that is the result of applying a reduction operation to the elements of the stream.

b) It performs a mutable reduction operation on the elements of the stream.

c) It performs an immutable reduction operation on the elements of the stream.

d) It performs a filter operation on the elements of the stream.

1 Answer

0 votes
by

Answer: b) It performs a mutable reduction operation on the elements of the stream.

Explanation: The Stream.collect() method performs a mutable reduction operation on the elements of the stream, using a Collector to accumulate the elements into a result container.

Related questions

0 votes
asked Apr 28 in JAVA by Robin
0 votes
asked Apr 26 in JAVA by SakshiSharma
...