From c02a1548525249d6219bac9e5efb40488f6c07d7 Mon Sep 17 00:00:00 2001 From: Xavier H Date: Thu, 6 May 2021 10:33:09 +0200 Subject: [PATCH] Use a stable sort algorithm for Iterable.sortedBy (dart-lang/collection#192) * Use a stable sort algorithm for Iterable.sortedBy * Increment version number and add changelog entry --- pkgs/collection/CHANGELOG.md | 4 +++- pkgs/collection/lib/src/iterable_extensions.dart | 4 ++-- pkgs/collection/pubspec.yaml | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pkgs/collection/CHANGELOG.md b/pkgs/collection/CHANGELOG.md index e39b9d2c..0e5a4af9 100644 --- a/pkgs/collection/CHANGELOG.md +++ b/pkgs/collection/CHANGELOG.md @@ -1,4 +1,6 @@ -## 1.15.1-dev +## 1.16.0 + +* Use a stable sort algorithm in the `IterableExtension.sortedBy` method. ## 1.15.0 diff --git a/pkgs/collection/lib/src/iterable_extensions.dart b/pkgs/collection/lib/src/iterable_extensions.dart index cddc4970..b0bf0ad0 100644 --- a/pkgs/collection/lib/src/iterable_extensions.dart +++ b/pkgs/collection/lib/src/iterable_extensions.dart @@ -64,7 +64,7 @@ extension IterableExtension on Iterable { /// property [keyOf] of the element. List sortedBy>(K Function(T element) keyOf) { var elements = [...this]; - quickSortBy(elements, keyOf, compareComparable); + mergeSortBy(elements, keyOf, compareComparable); return elements; } @@ -75,7 +75,7 @@ extension IterableExtension on Iterable { List sortedByCompare( K Function(T element) keyOf, Comparator compare) { var elements = [...this]; - quickSortBy(elements, keyOf, compare); + mergeSortBy(elements, keyOf, compare); return elements; } diff --git a/pkgs/collection/pubspec.yaml b/pkgs/collection/pubspec.yaml index 9ce3549e..c8a468ea 100644 --- a/pkgs/collection/pubspec.yaml +++ b/pkgs/collection/pubspec.yaml @@ -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