A

Admin • 828.70K Points
Coach

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: 7
  • Filed under category Java
  • Hashtags:

Explanation by: Admin
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.

Be the first to start discuss.