> For the complete documentation index, see [llms.txt](https://gold.gitbook.io/kotlin/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gold.gitbook.io/kotlin/collections/ordering-operations/sortedbydescending.md).

# sortedByDescending

```kotlin
public inline fun <T, R : Comparable<R>>
Iterable<T>.sortedByDescending(crossinline selector: (T) -> R?): List<T> {
    return sortedWith(compareByDescending(selector))
}

data class Person(val name: String, val age: Int)
val list = listOf(
    Person("gold", 20),
    Person("ari", 19),
    Person("kasadin", 50),
    Person("amumu", 15)
    )

println(list.sortedByDescending { it.age })
// [Person(name=kasadin, age=50), Person(name=gold, age=20), Person(name=ari, age=19), Person(name=amumu, age=15)]
```
