OLD | NEW |
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.collection; | 5 part of dart.collection; |
6 | 6 |
7 /** | 7 /** |
8 * This [Iterable] mixin implements all [Iterable] members except `iterator`. | 8 * This [Iterable] mixin implements all [Iterable] members except `iterator`. |
9 * | 9 * |
10 * All other methods are implemented in terms of `iterator`. | 10 * All other methods are implemented in terms of `iterator`. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } else { | 69 } else { |
70 buffer.write("${iterator.current}"); | 70 buffer.write("${iterator.current}"); |
71 while (iterator.moveNext()) { | 71 while (iterator.moveNext()) { |
72 buffer.write(separator); | 72 buffer.write(separator); |
73 buffer.write("${iterator.current}"); | 73 buffer.write("${iterator.current}"); |
74 } | 74 } |
75 } | 75 } |
76 return buffer.toString(); | 76 return buffer.toString(); |
77 } | 77 } |
78 | 78 |
79 bool any(bool f(E element)) { | 79 bool any(bool test(E element)) { |
80 for (E element in this) { | 80 for (E element in this) { |
81 if (f(element)) return true; | 81 if (test(element)) return true; |
82 } | 82 } |
83 return false; | 83 return false; |
84 } | 84 } |
85 | 85 |
86 List<E> toList({bool growable: true}) => | 86 List<E> toList({bool growable: true}) => |
87 new List<E>.from(this, growable: growable); | 87 new List<E>.from(this, growable: growable); |
88 | 88 |
89 Set<E> toSet() => new Set<E>.from(this); | 89 Set<E> toSet() => new Set<E>.from(this); |
90 | 90 |
91 int get length { | 91 int get length { |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 elision = "..."; | 389 elision = "..."; |
390 length += ELLIPSIS_SIZE + OVERHEAD; | 390 length += ELLIPSIS_SIZE + OVERHEAD; |
391 } | 391 } |
392 } | 392 } |
393 if (elision != null) { | 393 if (elision != null) { |
394 parts.add(elision); | 394 parts.add(elision); |
395 } | 395 } |
396 parts.add(penultimateString); | 396 parts.add(penultimateString); |
397 parts.add(ultimateString); | 397 parts.add(ultimateString); |
398 } | 398 } |
OLD | NEW |