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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 } | 84 } |
85 return false; | 85 return false; |
86 } | 86 } |
87 | 87 |
88 List<E> toList({ bool growable: true }) => | 88 List<E> toList({ bool growable: true }) => |
89 new List<E>.from(this, growable: growable); | 89 new List<E>.from(this, growable: growable); |
90 | 90 |
91 Set<E> toSet() => new Set<E>.from(this); | 91 Set<E> toSet() => new Set<E>.from(this); |
92 | 92 |
93 int get length { | 93 int get length { |
94 assert(this is! EfficientLengthIterable); | 94 assert(this is! EfficientLength); |
95 int count = 0; | 95 int count = 0; |
96 Iterator it = iterator; | 96 Iterator it = iterator; |
97 while (it.moveNext()) { | 97 while (it.moveNext()) { |
98 count++; | 98 count++; |
99 } | 99 } |
100 return count; | 100 return count; |
101 } | 101 } |
102 | 102 |
103 bool get isEmpty => !iterator.moveNext(); | 103 bool get isEmpty => !iterator.moveNext(); |
104 | 104 |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 elision = "..."; | 391 elision = "..."; |
392 length += ELLIPSIS_SIZE + OVERHEAD; | 392 length += ELLIPSIS_SIZE + OVERHEAD; |
393 } | 393 } |
394 } | 394 } |
395 if (elision != null) { | 395 if (elision != null) { |
396 parts.add(elision); | 396 parts.add(elision); |
397 } | 397 } |
398 parts.add(penultimateString); | 398 parts.add(penultimateString); |
399 parts.add(ultimateString); | 399 parts.add(ultimateString); |
400 } | 400 } |
OLD | NEW |