sortedWith method

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

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

Implementation

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