R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which method turns a stream into a Map with duplicate key handling?

  • (A) Collectors.toMap() with merge function
  • (B) Collectors.toMap() only
  • (C) Collectors.groupingBy() only
  • (D) Collectors.merge()
  • Correct Answer - Option(A)
  • Views: 2
  • Filed under category Java
  • Hashtags:

Explanation by: Ram Sharma
`Collectors.toMap()` can take a merge function to handle duplicate keys.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.