Skip to content

Commit

Permalink
Use a stable sort algorithm for Iterable.sortedBy (dart-lang/collecti…
Browse files Browse the repository at this point in the history
…on#192)

* Use a stable sort algorithm for Iterable.sortedBy

* Increment version number and add changelog entry
  • Loading branch information
xvrh authored May 6, 2021
1 parent 1e47424 commit c02a154
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pkgs/collection/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## 1.15.1-dev
## 1.16.0

* Use a stable sort algorithm in the `IterableExtension.sortedBy` method.

## 1.15.0

Expand Down
4 changes: 2 additions & 2 deletions pkgs/collection/lib/src/iterable_extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ extension IterableExtension<T> on Iterable<T> {
/// property [keyOf] of the element.
List<T> sortedBy<K extends Comparable<K>>(K Function(T element) keyOf) {
var elements = [...this];
quickSortBy<T, K>(elements, keyOf, compareComparable);
mergeSortBy<T, K>(elements, keyOf, compareComparable);
return elements;
}

Expand All @@ -75,7 +75,7 @@ extension IterableExtension<T> on Iterable<T> {
List<T> sortedByCompare<K>(
K Function(T element) keyOf, Comparator<K> compare) {
var elements = [...this];
quickSortBy<T, K>(elements, keyOf, compare);
mergeSortBy<T, K>(elements, keyOf, compare);
return elements;
}

Expand Down
2 changes: 1 addition & 1 deletion pkgs/collection/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: collection
version: 1.15.1-dev
version: 1.16.0

description: Collections and utilities functions and classes related to collections.
repository: https://github.com/dart-lang/collection
Expand Down

0 comments on commit c02a154

Please sign in to comment.