sortedBy method

SortedList<E> sortedBy(
  1. Comparable selector(
    1. E element
    )
)

Returns a new list with all elements sorted according to natural sort order of the values returned by specified selector function.

To sort by more than one property, thenBy() or thenByDescending() can be called afterwards.

Note: The actual sorting is performed when an element is accessed for the first time.

Implementation

SortedList<E> sortedBy(Comparable Function(E element) selector) {
  return SortedList<E>.withSelector(this, selector, 1, null);
}