R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which collector is suitable to convert a stream to an unmodifiable map?

  • (A) Collectors.toMap()
  • (B) Collectors.toUnmodifiableMap()
  • (C) Collectors.unmodifiableMap()
  • (D) Collectors.toCollection()
  • Correct Answer - Option(B)
  • Views: 7
  • Filed under category Java
  • Hashtags:

Explanation by: Ram Sharma
`toUnmodifiableMap()` collects elements into a read-only map.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.