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

Side by Side Diff: pkg/unmodifiable_collection/lib/unmodifiable_collection.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 | « pkg/third_party/html5lib/lib/src/list_proxy.dart ('k') | runtime/lib/array.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 /** 5 /**
6 * Wrappers that prevent List, Set, or Map objects from being modified. 6 * Wrappers that prevent List, Set, or Map objects from being modified.
7 * 7 *
8 * The [Set] and [Map] wrappers allow reading from the wrapped collection, 8 * The [Set] and [Map] wrappers allow reading from the wrapped collection,
9 * but prohibit writing. 9 * but prohibit writing.
10 * 10 *
11 * The [List] wrapper prevents changes to the length of the wrapped list, 11 * The [List] wrapper prevents changes to the length of the wrapped list,
12 * but allows changes to the contents. 12 * but allows changes to the contents.
13 */ 13 */
14 library unmodifiable_collection; 14 library unmodifiable_collection;
15 15
16 import "dart:math" show Random;
16 export "dart:collection" show UnmodifiableListView; 17 export "dart:collection" show UnmodifiableListView;
17 18
18 /** 19 /**
19 * A fixed-length list. 20 * A fixed-length list.
20 * 21 *
21 * A NonGrowableListView contains a [List] object and ensures that 22 * A NonGrowableListView contains a [List] object and ensures that
22 * its length does not change. 23 * its length does not change.
23 * Methods that would change the length of the list, 24 * Methods that would change the length of the list,
24 * such as [add] and [remove], throw an [UnsupportedError]. 25 * such as [add] and [remove], throw an [UnsupportedError].
25 * 26 *
(...skipping 25 matching lines...) Expand all
51 List<E> sublist(int start, [int end]) => _source.sublist(start, end); 52 List<E> sublist(int start, [int end]) => _source.sublist(start, end);
52 53
53 Iterable<E> get reversed => _source.reversed; 54 Iterable<E> get reversed => _source.reversed;
54 55
55 Map<int, E> asMap() => _source.asMap(); 56 Map<int, E> asMap() => _source.asMap();
56 57
57 void operator []=(int index, E value) { _source[index] = value; } 58 void operator []=(int index, E value) { _source[index] = value; }
58 59
59 void sort([int compare(E a, E b)]) { _source.sort(compare); } 60 void sort([int compare(E a, E b)]) { _source.sort(compare); }
60 61
61 void shuffle() { _source.shuffle(); } 62 void shuffle([Random random]) { _source.shuffle(random); }
62 63
63 void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]) { 64 void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]) {
64 _source.setRange(start, end, iterable, skipCount); 65 _source.setRange(start, end, iterable, skipCount);
65 } 66 }
66 67
67 void fillRange(int start, int end, [E fillValue]) { 68 void fillRange(int start, int end, [E fillValue]) {
68 _source.fillRange(start, end, fillValue); 69 _source.fillRange(start, end, fillValue);
69 } 70 }
70 71
71 void setAll(int index, Iterable<E> iterable) { 72 void setAll(int index, Iterable<E> iterable) {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 Iterable<E> take(int n) => _source.take(n); 350 Iterable<E> take(int n) => _source.take(n);
350 351
351 Iterable<E> takeWhile(bool test(E value)) => _source.takeWhile(test); 352 Iterable<E> takeWhile(bool test(E value)) => _source.takeWhile(test);
352 353
353 List<E> toList({ bool growable: true }) => _source.toList(growable: growable); 354 List<E> toList({ bool growable: true }) => _source.toList(growable: growable);
354 355
355 Set<E> toSet() => _source.toSet(); 356 Set<E> toSet() => _source.toSet();
356 357
357 Iterable<E> where(bool test(E element)) => _source.where(test); 358 Iterable<E> where(bool test(E element)) => _source.where(test);
358 } 359 }
OLDNEW
« no previous file with comments | « pkg/third_party/html5lib/lib/src/list_proxy.dart ('k') | runtime/lib/array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698