OLD | NEW |
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 * A collection of values, or "elements", that can be accessed sequentially. | 8 * A collection of values, or "elements", that can be accessed sequentially. |
9 * | 9 * |
10 * The elements of the iterable are accessed by getting an [Iterator] | 10 * The elements of the iterable are accessed by getting an [Iterator] |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 for (E element in this) value = combine(value, element); | 284 for (E element in this) value = combine(value, element); |
285 return value; | 285 return value; |
286 } | 286 } |
287 | 287 |
288 /** | 288 /** |
289 * Checks whether every element of this iterable satisfies [test]. | 289 * Checks whether every element of this iterable satisfies [test]. |
290 * | 290 * |
291 * Checks every element in iteration order, and returns `false` if | 291 * Checks every element in iteration order, and returns `false` if |
292 * any of them make [test] return `false`, otherwise returns `true`. | 292 * any of them make [test] return `false`, otherwise returns `true`. |
293 */ | 293 */ |
294 bool every(bool f(E element)) { | 294 bool every(bool test(E element)) { |
295 for (E element in this) { | 295 for (E element in this) { |
296 if (!f(element)) return false; | 296 if (!test(element)) return false; |
297 } | 297 } |
298 return true; | 298 return true; |
299 } | 299 } |
300 | 300 |
301 /** | 301 /** |
302 * Converts each element to a [String] and concatenates the strings. | 302 * Converts each element to a [String] and concatenates the strings. |
303 * | 303 * |
304 * Iterates through elements of this iterable, | 304 * Iterates through elements of this iterable, |
305 * converts each one to a [String] by calling [Object.toString], | 305 * converts each one to a [String] by calling [Object.toString], |
306 * and then concatenates the strings, with the | 306 * and then concatenates the strings, with the |
(...skipping 16 matching lines...) Expand all Loading... |
323 } | 323 } |
324 return buffer.toString(); | 324 return buffer.toString(); |
325 } | 325 } |
326 | 326 |
327 /** | 327 /** |
328 * Checks whether any element of this iterable satisfies [test]. | 328 * Checks whether any element of this iterable satisfies [test]. |
329 * | 329 * |
330 * Checks every element in iteration order, and returns `true` if | 330 * Checks every element in iteration order, and returns `true` if |
331 * any of them make [test] return `true`, otherwise returns false. | 331 * any of them make [test] return `true`, otherwise returns false. |
332 */ | 332 */ |
333 bool any(bool f(E element)) { | 333 bool any(bool test(E element)) { |
334 for (E element in this) { | 334 for (E element in this) { |
335 if (f(element)) return true; | 335 if (test(element)) return true; |
336 } | 336 } |
337 return false; | 337 return false; |
338 } | 338 } |
339 | 339 |
340 /** | 340 /** |
341 * Creates a [List] containing the elements of this [Iterable]. | 341 * Creates a [List] containing the elements of this [Iterable]. |
342 * | 342 * |
343 * The elements are in iteration order. | 343 * The elements are in iteration order. |
344 * The list is fixed-length if [growable] is false. | 344 * The list is fixed-length if [growable] is false. |
345 */ | 345 */ |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 */ | 645 */ |
646 abstract class BidirectionalIterator<E> implements Iterator<E> { | 646 abstract class BidirectionalIterator<E> implements Iterator<E> { |
647 /** | 647 /** |
648 * Move back to the previous element. | 648 * Move back to the previous element. |
649 * | 649 * |
650 * Returns true and updates [current] if successful. Returns false | 650 * Returns true and updates [current] if successful. Returns false |
651 * and sets [current] to null if there is no previous element. | 651 * and sets [current] to null if there is no previous element. |
652 */ | 652 */ |
653 bool movePrevious(); | 653 bool movePrevious(); |
654 } | 654 } |
OLD | NEW |