Q. What is the purpose of the flatMap() method in a stream pipeline?
β
Correct 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.