W3cubDocs

/Kotlin

sortedByDescending

inline fun <T, R : Comparable<R>> Array<out T>.sortedByDescending(
    crossinline selector: (T) -> R?
): List<T>
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>
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.

© 2010–2017 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/sorted-by-descending.html