R

Ram Sharma • 3.40K Points
Extraordinary

Q. What will happen if a merge function in `Collectors.toMap()` returns null?

  • (A) Nothing
  • (B) Null is inserted
  • (C) NullPointerException is thrown
  • (D) Empty string is used
  • Correct Answer - Option(C)
  • Views: 25
  • Filed under category Java
  • Hashtags:

Explanation by: Ram Sharma

The merge function must not return null; otherwise, `NullPointerException` will be thrown.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.