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

Unified Diff: runtime/lib/immutable_map.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 | « runtime/lib/collection_patch.dart ('k') | sdk/lib/_collection_dev/iterable.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/immutable_map.dart
diff --git a/runtime/lib/immutable_map.dart b/runtime/lib/immutable_map.dart
index 475051f9653b5d406e9873c90d8621d8c0f446ba..2377c8c3d0909c964b6828498209839abc9f91b6 100644
--- a/runtime/lib/immutable_map.dart
+++ b/runtime/lib/immutable_map.dart
@@ -84,22 +84,28 @@ class ImmutableMap<K, V> implements Map<K, V> {
}
}
-class _ImmutableMapKeyIterable<E> extends IterableBase<E> {
+class _ImmutableMapKeyIterable<E> extends IterableBase<E>
+ implements EfficientLength {
final ImmutableMap _map;
_ImmutableMapKeyIterable(this._map);
Iterator<E> get iterator {
return new _ImmutableMapKeyIterator<E>(_map);
}
+
+ int get length => _map.length;
}
-class _ImmutableMapValueIterable<E> extends IterableBase<E> {
+class _ImmutableMapValueIterable<E> extends IterableBase<E>
+ implements EfficientLength {
final ImmutableMap _map;
_ImmutableMapValueIterable(this._map);
Iterator<E> get iterator {
return new _ImmutableMapValueIterator<E>(_map);
}
+
+ int get length => _map.length;
}
class _ImmutableMapKeyIterator<E> implements Iterator<E> {
« no previous file with comments | « runtime/lib/collection_patch.dart ('k') | sdk/lib/_collection_dev/iterable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698