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

Side by Side Diff: sdk/lib/core/list.dart

Issue 24740003: Add List.shuffle(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of dart.core; 5 part of dart.core;
6 6
7 /** 7 /**
8 * An indexable collection of objects with a length. 8 * An indexable collection of objects with a length.
9 * 9 *
10 * Subclasses of this class implement different kinds of lists. 10 * Subclasses of this class implement different kinds of lists.
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 * Sorts this list according to the order specified by the [compare] function. 158 * Sorts this list according to the order specified by the [compare] function.
159 * 159 *
160 * The [compare] function must act as a [Comparator]. 160 * The [compare] function must act as a [Comparator].
161 * 161 *
162 * The default List implementations use [Comparable.compare] if 162 * The default List implementations use [Comparable.compare] if
163 * [compare] is omitted. 163 * [compare] is omitted.
164 */ 164 */
165 void sort([int compare(E a, E b)]); 165 void sort([int compare(E a, E b)]);
166 166
167 /** 167 /**
168 * Shuffles the elements of this list randomly.
169 */
170 void shuffle();
171
172 /**
168 * Returns the first index of [element] in this list. 173 * Returns the first index of [element] in this list.
169 * 174 *
170 * Searches the list from index [start] to the length of the list. 175 * Searches the list from index [start] to the length of the list.
171 * The first time an object [:o:] is encountered so that [:o == element:], 176 * The first time an object [:o:] is encountered so that [:o == element:],
172 * the index of [:o:] is returned. 177 * the index of [:o:] is returned.
173 * Returns -1 if [element] is not found. 178 * Returns -1 if [element] is not found.
174 */ 179 */
175 int indexOf(E element, [int start = 0]); 180 int indexOf(E element, [int start = 0]);
176 181
177 /** 182 /**
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 371
367 /** 372 /**
368 * Returns an unmodifiable [Map] view of `this`. 373 * Returns an unmodifiable [Map] view of `this`.
369 * 374 *
370 * The map uses the indices of this list as keys and the corresponding objects 375 * The map uses the indices of this list as keys and the corresponding objects
371 * as values. The `Map.keys` [Iterable] iterates the indices of this list 376 * as values. The `Map.keys` [Iterable] iterates the indices of this list
372 * in numerical order. 377 * in numerical order.
373 */ 378 */
374 Map<int, E> asMap(); 379 Map<int, E> asMap();
375 } 380 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698