Logo

Programming-Idioms

History of Idiom 28 > diff from v57 to v58

Edit summary for version 58 by hover:
[Kotlin] add doc

Version 57

2020-04-29, 09:13:00

Version 58

2020-04-29, 10:43:32

Idiom #28 Sort by a property

Sort elements of array-like collection items in ascending order of x.p, where p is a field of the type Item of the objects in items.

Idiom #28 Sort by a property

Sort elements of array-like collection items in ascending order of x.p, where p is a field of the type Item of the objects in items.

Code
items.sortedBy { it.p }
Code
items.sortedBy { it.p }
Doc URL
https://kotlinlang.org/docs/reference/collection-ordering.html#custom-orders