Programming-Idioms

History of Idiom 28 > diff from v47 to v48

Edit summary for version 48 :
New Kotlin implementation by user [zr8c]

Version 47

Version 48

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 }