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

Side by Side Diff: runtime/lib/typed_data.dart

Issue 25931003: Make List.shuffle take an optional Random object to use. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comment. Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/lib/growable_array.dart ('k') | sdk/lib/_collection_dev/iterable.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // patch classes for Int8List ..... Float64List and ByteData implementations. 5 // patch classes for Int8List ..... Float64List and ByteData implementations.
6 6
7 patch class Int8List { 7 patch class Int8List {
8 /* patch */ factory Int8List(int length) { 8 /* patch */ factory Int8List(int length) {
9 return new _Int8Array(length); 9 return new _Int8Array(length);
10 } 10 }
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 403
404 void insertAll(int index, Iterable values) { 404 void insertAll(int index, Iterable values) {
405 throw new UnsupportedError( 405 throw new UnsupportedError(
406 "Cannot insert into a non-extendable array"); 406 "Cannot insert into a non-extendable array");
407 } 407 }
408 408
409 void sort([int compare(num a, num b)]) { 409 void sort([int compare(num a, num b)]) {
410 IterableMixinWorkaround.sortList(this, compare); 410 IterableMixinWorkaround.sortList(this, compare);
411 } 411 }
412 412
413 void shuffle() { 413 void shuffle([Random random]) {
414 IterableMixinWorkaround.shuffleList(this); 414 IterableMixinWorkaround.shuffleList(this, random);
415 } 415 }
416 416
417 int indexOf(element, [int start = 0]) { 417 int indexOf(element, [int start = 0]) {
418 return IterableMixinWorkaround.indexOfList(this, element, start); 418 return IterableMixinWorkaround.indexOfList(this, element, start);
419 } 419 }
420 420
421 int lastIndexOf(element, [int start = null]) { 421 int lastIndexOf(element, [int start = null]) {
422 return IterableMixinWorkaround.lastIndexOfList(this, element, start); 422 return IterableMixinWorkaround.lastIndexOfList(this, element, start);
423 } 423 }
424 424
(...skipping 2728 matching lines...) Expand 10 before | Expand all | Expand 10 after
3153 return value; 3153 return value;
3154 } 3154 }
3155 return object; 3155 return object;
3156 } 3156 }
3157 3157
3158 3158
3159 void _throwRangeError(int index, int length) { 3159 void _throwRangeError(int index, int length) {
3160 String message = "$index must be in the range [0..$length)"; 3160 String message = "$index must be in the range [0..$length)";
3161 throw new RangeError(message); 3161 throw new RangeError(message);
3162 } 3162 }
OLDNEW
« no previous file with comments | « runtime/lib/growable_array.dart ('k') | sdk/lib/_collection_dev/iterable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698