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);
}