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

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

Issue 12401002: Make List.from and Iterable.toList default to not growable. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 | « sdk/lib/collection/queue.dart ('k') | sdk/lib/core/list.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) 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({ bool growable: false }) => 159 List<E> toList({ bool growable: true }) =>
160 new List<E>.from(this, growable: growable); 160 new List<E>.from(this, growable: growable);
161 Set<E> toSet() => new Set<E>.from(this); 161 Set<E> toSet() => new Set<E>.from(this);
162 162
163 /** 163 /**
164 * Returns the number of elements in [this]. 164 * Returns the number of elements in [this].
165 * 165 *
166 * 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
167 * therefore be slow. 167 * therefore be slow.
168 */ 168 */
169 int get length { 169 int get length {
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 */ 433 */
434 abstract class BidirectionalIterator<T> extends Iterator<T> { 434 abstract class BidirectionalIterator<T> extends Iterator<T> {
435 /** 435 /**
436 * Move back to the previous element. 436 * Move back to the previous element.
437 * 437 *
438 * Returns true and updates [current] if successful. Returns false 438 * Returns true and updates [current] if successful. Returns false
439 * and sets [current] to null if there is no previous element. 439 * and sets [current] to null if there is no previous element.
440 */ 440 */
441 bool movePrevious(); 441 bool movePrevious();
442 } 442 }
OLDNEW
« no previous file with comments | « sdk/lib/collection/queue.dart ('k') | sdk/lib/core/list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698