R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which method is used to convert a Stream to a List?

  • (A) toList()
  • (B) collect(Collectors.toList())
  • (C) asList()
  • (D) streamToList()
  • Correct Answer - Option(B)
  • Views: 11
  • Filed under category Java
  • Hashtags:

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

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.