Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Use a stable sort algorithm for Iterable.sortedBy #192

Merged
merged 2 commits into from
May 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion 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 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 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