Which method is used to sort elements of a Stream?

  1. sort()
  2. arrange()
  3. sorted()
  4. orderBy()
Correct answer sorted()

Explanation

sorted() is used to sort elements in the natural or custom order.

Update: Admin added a tag on this question

Topics

By Admin · · 30 views