P

Pushkar • 380 Points
Valuable

Q. 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
  • Correct Answer - Option(B)
  • Views: 199
  • Filed under category JAVA

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

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics