Skip to content

Instantly share code, notes, and snippets.

View madken's full-sized avatar

Kenneth Madsen madken

View GitHub Profile
@madken
madken / sortListPair.kt
Last active March 31, 2024 07:40
kotlin sort a list of pairs by second and then first value
fun sortListOfPairDesc(list: List<Pair<String, Int>>): List<Pair<String, Int>> {
return list.sortedWith(compareBy({ it.second }, { it.first })).asReversed()
}