Skip to content

Commit c373a79

Browse files
committed
[sorted-functions] using sortWith in code
1 parent 4bfc291 commit c373a79

File tree

1 file changed

+2
-1
lines changed
  • core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/sorting

1 file changed

+2
-1
lines changed

core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/sorting/SortingExample.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@ fun extendedComparatorUsage() {
3939

4040
val ageComparator = compareBy<Pair<Int, String?>> {it.first}
4141
val ageAndNameComparator = ageComparator.thenByDescending {it.second}
42-
println(students.sortedWith(ageAndNameComparator))
42+
students.sortWith(ageAndNameComparator)
43+
println(students)
4344
}

0 commit comments

Comments
 (0)