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

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

Issue 1154263003: Revert "Make EfficientLength public, as EfficientLengthIterable." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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/compiler/js_lib/linked_hash_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 855659510d49143d65a8a4cfcef1e6732cbb7a08..329068244596f292d2c552e5d94d87d93ebb717f 100644
--- a/sdk/lib/collection/iterable.dart
+++ b/sdk/lib/collection/iterable.dart
@@ -90,7 +90,7 @@ abstract class IterableMixin<E> implements Iterable<E> {
Set<E> toSet() => new Set<E>.from(this);
int get length {
- assert(this is! EfficientLengthIterable);
+ assert(this is! EfficientLength);
int count = 0;
Iterator it = iterator;
while (it.moveNext()) {
@@ -397,34 +397,3 @@ void _iterablePartsToStrings(Iterable iterable, List parts) {
parts.add(penultimateString);
parts.add(ultimateString);
}
-
-
-/**
- * Marker interface for [Iterable] implementations that have an efficient
- * [length] getter.
- *
- * An iterable implementing this interface should have an "efficient"
- * implementation of `length` that doesn't trigger iteration of the
- * iterable. Being efficient doesn't necessarily require being constant
- * time, but should at least attempt to have have execution time that is
- * better than linear in the elements of the iterable.
- *
- * Methods that worry about reading the length of an `Iterable` because it
- * may be inefficient or may trigger side-effects, or may even never complete,
- * can first check if the iterable `is EfficientLengthIterable`,
- * and if so, use [length] without those concerns.
- *
- * The `EfficientLengthIterable` type should never be used as a type
- * assertion - neither as argument type or return type of a function.
- * Always use [Iterable] for the type and just document the performance if it
- * is relevant. This avoids needlessly restricting the values that can be used.
- */
-abstract class EfficientLengthIterable<T> implements Iterable<T> {
- /**
- * Returns the number of elements in the iterable.
- *
- * This is an efficient operation that doesn't iterate through
- * the elements.
- */
- int get length;
-}
« no previous file with comments | « sdk/lib/_internal/compiler/js_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