sorted method

List<E> sorted()

Returns a new list with all elements sorted according to natural sort order.

Implementation

List<E> sorted() {
  var list = toList();
  list.sort();
  return list;
}