R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which terminal operation collects elements into a map?

  • (A) collect(Collectors.toMap())
  • (B) collect(Collectors.toHashMap())
  • (C) collect(Collectors.map())
  • (D) collect(Map::new)
  • Correct Answer - Option(A)
  • Views: 2
  • Filed under category Java
  • Hashtags:

Explanation by: Ram Sharma
`Collectors.toMap()` is used to collect stream elements into a Map.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.