0 votes
in JAVA by
What is the purpose of the flatMap() method in a stream pipeline?

a) To combine multiple streams into a single stream

b) To transform each element of a stream into a new stream

c) To remove duplicates from a stream

d) To sort the elements of a stream

1 Answer

0 votes
by
Answer: b) To transform each element of a stream into a new stream.

Explanation: The flatMap() method allows you to replace each element of a stream with a new stream, which is then flattened into a single stream.

Related questions

0 votes
asked Apr 26 in JAVA by SakshiSharma
0 votes
asked May 5 in JAVA by sharadyadav1986
...