A

Admin • 833.24K Points
Coach

Q. What happens if duplicate keys are provided to `Collectors.toMap()`?

  • (A) Last one wins
  • (B) Exception is thrown
  • (C) Ignored
  • (D) Merged automatically

Explanation by: Admin

If duplicate keys occur in `Collectors.toMap()` without a merge function, `IllegalStateException` is thrown.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.