R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which method allows you to use a custom merge function in `toMap()`?

  • (A) toMap(keyMapper, valueMapper)
  • (B) toMap(keyMapper, valueMapper, mergeFunction)
  • (C) toMap(mergeFunction)
  • (D) toMap(keyMapper, mergeFunction)
  • Correct Answer - Option(B)
  • Views: 5
  • Filed under category Java
  • Hashtags:

Explanation by: Ram Sharma
The overload `toMap(k, v, mergeFunction)` resolves duplicate keys using the merge function.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.