sortedWith method

  1. @useResult
KtList<T> sortedWith(
  1. Comparator<T> comparator
)

Returns a list of all elements sorted according to the specified comparator.

Implementation

@useResult
KtList<T> sortedWith(Comparator<T> comparator) {
  final mutableList = toMutableList();
  // delegate to darts list implementation for sorting which is highly optimized
  mutableList.asList().sort(comparator);
  return mutableList;
}