Programming-Idioms

History of Idiom 28 > diff from v10 to v11

Edit summary for version 11 :

Version 10

2015-08-01, 01:19:18

Version 11

2015-08-20, 10:21:53

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_by(|a,b|a.p.cmp(&b.p));