Logo

Programming-Idioms

History of Idiom 28 > diff from v48 to v49

Edit summary for version 49 by zr8c:
[Kotlin] because I didn't read the instructions

Version 48

2019-09-26, 19:03:20

Version 49

2019-09-26, 19:04:40

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
listOf("dave", "mark", "simon", "jim").sortedBy { it.length }
Code
items.sortedBy { it.p }