sortedWith method

_SortedList<E> sortedWith(
  1. Comparator<E> comparator
)

Returns a new list with all elements sorted according to specified comparator.

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> sortedWith(Comparator<E> comparator) {
  return _SortedList<E>._(this, comparator);
}