sortedByDescending

Common
JVM
JS
Native
1.0
inline fun <T, R : Comparable<R>> Array<out T>.sortedByDescending(
    crossinline selector: (T) -> R?
): List<T>
inline fun <T, R : Comparable<R>> Iterable<T>.sortedByDescending(
    crossinline selector: (T) -> R?
): List<T>

Returns a list of all elements sorted descending according to natural sort order of the value returned by specified selector function.

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

Common
JVM
JS
Native
1.0
inline fun <R : Comparable<R>> ByteArray.sortedByDescending(
    crossinline selector: (Byte) -> R?
): List<Byte>
inline fun <R : Comparable<R>> ShortArray.sortedByDescending(
    crossinline selector: (Short) -> R?
): List<Short>
inline fun <R : Comparable<R>> IntArray.sortedByDescending(
    crossinline selector: (Int) -> R?
): List<Int>
inline fun <R : Comparable<R>> LongArray.sortedByDescending(
    crossinline selector: (Long) -> R?
): List<Long>
inline fun <R : Comparable<R>> FloatArray.sortedByDescending(
    crossinline selector: (Float) -> R?
): List<Float>
inline fun <R : Comparable<R>> DoubleArray.sortedByDescending(
    crossinline selector: (Double) -> R?
): List<Double>
inline fun <R : Comparable<R>> BooleanArray.sortedByDescending(
    crossinline selector: (Boolean) -> R?
): List<Boolean>
inline fun <R : Comparable<R>> CharArray.sortedByDescending(
    crossinline selector: (Char) -> R?
): List<Char>

Returns a list of all elements sorted descending according to natural sort order of the value returned by specified selector function.