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