Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Unified Diff: runtime/lib/array.dart

Issue 11144016: Make argument of List.sort optional with default Comparable.compare. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/lib/array.dart
diff --git a/runtime/lib/array.dart b/runtime/lib/array.dart
index 75a674f745f8a6eef678df80a9694b6a8a8fa590..9df153d9f11eff082f636123239ae2ad48bac89a 100644
--- a/runtime/lib/array.dart
+++ b/runtime/lib/array.dart
@@ -92,7 +92,7 @@ class _ObjectArray<E> implements List<E> {
return this.length === 0;
}
- void sort(int compare(E a, E b)) {
+ void sort([Comparator<E> compare = Comparable.compare]) {
DualPivotQuicksort.sort(this, compare);
}
@@ -234,7 +234,7 @@ class _ImmutableArray<E> implements List<E> {
return this.length === 0;
}
- void sort(int compare(E a, E b)) {
+ void sort([Comparator<E> compare]) {
throw const UnsupportedOperationException(
"Cannot modify an immutable array");
}

Powered by Google App Engine
This is Rietveld 408576698