R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which collector would you use to collect stream elements into a Set?

  • (A) Collectors.toCollection()
  • (B) Collectors.toSet()
  • (C) Collectors.groupingBy()
  • (D) Collectors.partitioningBy()
  • Correct Answer - Option(B)
  • Views: 5
  • Filed under category Java
  • Hashtags:

Explanation by: Ram Sharma
`Collectors.toSet()` is used to collect elements into a Set.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.