R

Ram Sharma • 3.40K Points
Extraordinary

Q. What does the `sorted()` method do in Java Streams?

  • (A) Randomizes the order of stream elements
  • (B) Sorts the stream in reverse order
  • (C) Sorts the stream in natural order
  • (D) Filters sorted values
  • Correct Answer - Option(C)
  • Views: 8
  • Filed under category Java
  • Hashtags:

Explanation by: Ram Sharma
`sorted()` sorts elements of the stream in their natural order.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.