KT-20357 Add sortedBy() sample (#3283)

This commit is contained in:
Dmitry Borodin
2020-05-19 18:21:21 +02:00
committed by GitHub
parent 0d71758112
commit 1a0b59da49
5 changed files with 32 additions and 1 deletions
@@ -809,6 +809,14 @@ class Collections {
assertPrints(people.joinToString(), "Sweyn Forkbeard, Ragnar Lodbrok, Bjorn Ironside")
}
@Sample
fun sortedBy() {
val list = listOf("aaa", "cc", "bbbb")
val sorted = list.sortedBy { it.length }
assertPrints(list, "[aaa, cc, bbbb]")
assertPrints(sorted, "[cc, aaa, bbbb]")
}
}
class Filtering {