sortedWith

Common
JVM
JS
Native
1.0
fun <T> Array<out T>.sortedWith(
    comparator: Comparator<in T>
): List<T>

(source)
fun <T> Iterable<T>.sortedWith(
    comparator: Comparator<in T>
): List<T>

(source)

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

The sort is stable. It means that equal elements preserve their order relative to each other after sorting.

Common
JVM
JS
Native
1.0
fun ByteArray.sortedWith(
    comparator: Comparator<in Byte>
): List<Byte>

(source)
fun ShortArray.sortedWith(
    comparator: Comparator<in Short>
): List<Short>

(source)
fun IntArray.sortedWith(
    comparator: Comparator<in Int>
): List<Int>

(source)
fun LongArray.sortedWith(
    comparator: Comparator<in Long>
): List<Long>

(source)
fun FloatArray.sortedWith(
    comparator: Comparator<in Float>
): List<Float>

(source)
fun DoubleArray.sortedWith(
    comparator: Comparator<in Double>
): List<Double>

(source)
fun BooleanArray.sortedWith(
    comparator: Comparator<in Boolean>
): List<Boolean>

(source)
fun CharArray.sortedWith(
    comparator: Comparator<in Char>
): List<Char>

(source)

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