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

Unified Diff: sdk/lib/collection/iterable.dart

Issue 26681002: Add EfficientLength marker interface to some iterabels. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Also document Map.length is efficient, while we are at it. Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/lib/constant_map.dart ('k') | sdk/lib/collection/list.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/collection/iterable.dart
diff --git a/sdk/lib/collection/iterable.dart b/sdk/lib/collection/iterable.dart
index 9cbdf897caabe9d6e9ba04664887b3856f1e4660..0e5989d28d82cd2293c5753e8a010a2e5cbd10db 100644
--- a/sdk/lib/collection/iterable.dart
+++ b/sdk/lib/collection/iterable.dart
@@ -85,6 +85,7 @@ abstract class IterableMixin<E> implements Iterable<E> {
Set<E> toSet() => new Set<E>.from(this);
int get length {
+ assert(this is! EfficientLength);
int count = 0;
Iterator it = iterator;
while (it.moveNext()) {
@@ -276,6 +277,7 @@ abstract class IterableBase<E> implements Iterable<E> {
Set<E> toSet() => new Set<E>.from(this);
int get length {
+ assert(this is! EfficientLength);
int count = 0;
Iterator it = iterator;
while (it.moveNext()) {
« no previous file with comments | « sdk/lib/_internal/lib/constant_map.dart ('k') | sdk/lib/collection/list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698