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

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

Issue 12328104: Change new List(n) to return fixed length list. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 * The [Iterable] interface allows to get an [Iterator] out of an 8 * The [Iterable] interface allows to get an [Iterator] out of an
9 * [Iterable] object. 9 * [Iterable] object.
10 * 10 *
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 * Returns true if one element of this collection satisfies the 149 * Returns true if one element of this collection satisfies the
150 * predicate [f]. Returns false otherwise. 150 * predicate [f]. Returns false otherwise.
151 */ 151 */
152 bool any(bool f(E element)) { 152 bool any(bool f(E element)) {
153 for (E element in this) { 153 for (E element in this) {
154 if (f(element)) return true; 154 if (f(element)) return true;
155 } 155 }
156 return false; 156 return false;
157 } 157 }
158 158
159 List<E> toList() => new List<E>.from(this); 159 List<E> toList({ bool growable: false }) =>
160 new List<E>.from(this, growable: growable);
160 Set<E> toSet() => new Set<E>.from(this); 161 Set<E> toSet() => new Set<E>.from(this);
161 162
162 /** 163 /**
163 * Returns the number of elements in [this]. 164 * Returns the number of elements in [this].
164 * 165 *
165 * Counting all elements may be involve running through all elements and can 166 * Counting all elements may be involve running through all elements and can
166 * therefore be slow. 167 * therefore be slow.
167 */ 168 */
168 int get length { 169 int get length {
169 int count = 0; 170 int count = 0;
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 */ 433 */
433 abstract class BidirectionalIterator<T> extends Iterator<T> { 434 abstract class BidirectionalIterator<T> extends Iterator<T> {
434 /** 435 /**
435 * Move back to the previous element. 436 * Move back to the previous element.
436 * 437 *
437 * Returns true and updates [current] if successful. Returns false 438 * Returns true and updates [current] if successful. Returns false
438 * and sets [current] to null if there is no previous element. 439 * and sets [current] to null if there is no previous element.
439 */ 440 */
440 bool movePrevious(); 441 bool movePrevious();
441 } 442 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698