0 votes
in JAVA by

What is the purpose of the map() method in a stream pipeline?

a) To remove elements from the stream

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

c) To combine elements of the stream into a single element

d) To terminate the stream and return a single result

1 Answer

0 votes
by

Answer: b) To transform each element of the stream into a new element.

Explanation: The map() method allows you to apply a function to each element of the stream, transforming the stream into a new stream of elements.

Related questions

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