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

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

Issue 17020004: State that skip/take does not accept negative arguments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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_dev/iterable.dart ('k') | tests/corelib/iterable_skip_test.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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 /** 164 /**
165 * Returns true if there is at least one element in this collection. 165 * Returns true if there is at least one element in this collection.
166 */ 166 */
167 bool get isNotEmpty; 167 bool get isNotEmpty;
168 168
169 /** 169 /**
170 * Returns an [Iterable] with at most [n] elements. 170 * Returns an [Iterable] with at most [n] elements.
171 * 171 *
172 * The returned [Iterable] may contain fewer than [n] elements, if `this` 172 * The returned [Iterable] may contain fewer than [n] elements, if `this`
173 * contains fewer than [n] elements. 173 * contains fewer than [n] elements.
174 *
175 * It is an error if [n] is negative.
174 */ 176 */
175 Iterable<E> take(int n); 177 Iterable<E> take(int n);
176 178
177 /** 179 /**
178 * Returns an [Iterable] that stops once [test] is not satisfied anymore. 180 * Returns an [Iterable] that stops once [test] is not satisfied anymore.
179 * 181 *
180 * The filtering happens lazily. Every new [Iterator] of the returned 182 * The filtering happens lazily. Every new [Iterator] of the returned
181 * [Iterable] will start iterating over the elements of `this`. 183 * [Iterable] will start iterating over the elements of `this`.
182 * 184 *
183 * When the iterator encounters an element `e` that does not satisfy [test], 185 * When the iterator encounters an element `e` that does not satisfy [test],
184 * it discards `e` and moves into the finished state. That is, it will not 186 * it discards `e` and moves into the finished state. That is, it will not
185 * ask or provide any more elements. 187 * ask or provide any more elements.
186 */ 188 */
187 Iterable<E> takeWhile(bool test(E value)); 189 Iterable<E> takeWhile(bool test(E value));
188 190
189 /** 191 /**
190 * Returns an [Iterable] that skips the first [n] elements. 192 * Returns an [Iterable] that skips the first [n] elements.
191 * 193 *
192 * If `this` has fewer than [n] elements, then the resulting [Iterable] will 194 * If `this` has fewer than [n] elements, then the resulting [Iterable] will
193 * be empty. 195 * be empty.
196 *
197 * It is an error if [n] is negative.
194 */ 198 */
195 Iterable<E> skip(int n); 199 Iterable<E> skip(int n);
196 200
197 /** 201 /**
198 * Returns an [Iterable] that skips elements while [test] is satisfied. 202 * Returns an [Iterable] that skips elements while [test] is satisfied.
199 * 203 *
200 * The filtering happens lazily. Every new [Iterator] of the returned 204 * The filtering happens lazily. Every new [Iterator] of the returned
201 * [Iterable] iterates over all elements of `this`. 205 * [Iterable] iterates over all elements of `this`.
202 * 206 *
203 * As long as the iterator's elements satisfy [test] they are 207 * As long as the iterator's elements satisfy [test] they are
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 */ 307 */
304 abstract class BidirectionalIterator<E> implements Iterator<E> { 308 abstract class BidirectionalIterator<E> implements Iterator<E> {
305 /** 309 /**
306 * Move back to the previous element. 310 * Move back to the previous element.
307 * 311 *
308 * Returns true and updates [current] if successful. Returns false 312 * Returns true and updates [current] if successful. Returns false
309 * and sets [current] to null if there is no previous element. 313 * and sets [current] to null if there is no previous element.
310 */ 314 */
311 bool movePrevious(); 315 bool movePrevious();
312 } 316 }
OLDNEW
« no previous file with comments | « sdk/lib/_collection_dev/iterable.dart ('k') | tests/corelib/iterable_skip_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698