Logo

Programming-Idioms

History of Idiom 28 > diff from v52 to v53

Edit summary for version 53 by mm:
[Dart] mm

Version 52

2019-10-14, 12:23:42

Version 53

2020-02-26, 06:44:03

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