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

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

Issue 2467283003: Revert "Make EfficientLength extend Iterable." (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart ('k') | sdk/lib/collection/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) 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
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
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 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart ('k') | sdk/lib/collection/list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698