public fun <T : Comparable<T>> Iterable<T>.sortedDescending(): List<T> { return sortedWith(reverseOrder()) } val list = listOf(1, 2, 3, 4, 5) println(list.sortedDescending()) // [5, 4, 3, 2, 1]
Last updated 6 years ago