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

Unified Diff: runtime/lib/array.dart

Issue 24740003: Add List.shuffle(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adddress comments Created 7 years, 3 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
« no previous file with comments | « pkg/unmodifiable_collection/lib/unmodifiable_collection.dart ('k') | runtime/lib/growable_array.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/array.dart
diff --git a/runtime/lib/array.dart b/runtime/lib/array.dart
index e16cbef904c657979f7124d82b9b251a687e3adb..6582248e3dc6150b9ef33254d81a469d41d0ce92 100644
--- a/runtime/lib/array.dart
+++ b/runtime/lib/array.dart
@@ -202,6 +202,10 @@ class _ObjectArray<E> implements List<E> {
IterableMixinWorkaround.sortList(this, compare);
}
+ void shuffle() {
+ IterableMixinWorkaround.shuffleList(this);
+ }
+
int indexOf(Object element, [int start = 0]) {
return Arrays.indexOf(this, element, start, this.length);
}
@@ -456,6 +460,11 @@ class _ImmutableArray<E> implements List<E> {
"Cannot modify an immutable array");
}
+ void shuffle() {
+ throw new UnsupportedError(
+ "Cannot modify an immutable array");
+ }
+
String toString() {
return IterableMixinWorkaround.toStringIterable(this, '[', ']');
}
« no previous file with comments | « pkg/unmodifiable_collection/lib/unmodifiable_collection.dart ('k') | runtime/lib/growable_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698