Login
Remember
Register
Ask a Question
What is the purpose of the flatMap() method in a stream pipeline?
0
votes
asked
Apr 28, 2024
in
JAVA
by
Robin
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
flatmap
method
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Apr 28, 2024
by
Robin
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.
...