This function sorts the collection by their natural sort order. It can only be called if the generic type parameter implements the Comparable<T> interface:
val numbers = listOf(2, 1, 5, 3, 4)
val sorted = numbers.sorted()
This function sorts the collection by their natural sort order. It can only be called if the generic type parameter implements the Comparable<T> interface:
val numbers = listOf(2, 1, 5, 3, 4)
val sorted = numbers.sorted()
18.219.44.108