Programming-Idioms

History of Idiom 28 > diff from v13 to v14

Edit summary for version 14 :

Version 13

2015-08-21, 16:27:51

Version 14

2015-08-23, 10:19:49

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 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 type Item of the objects in items.

Code
items.sort((a, b) => (a.p).compareTo(b.p));