Logo

Programming-Idioms

History of Idiom 28 > diff from v53 to v54

Edit summary for version 54 by mm:
New Dart implementation by user [mm]

Version 53

2020-02-26, 06:44:03

Version 54

2020-02-26, 06:45:54

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
List<String> users =["a","b","c"];
users.sort((a, b) => a.length.compareTo(b.length));