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

Unified Diff: runtime/lib/collection_patch.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 | « pkg/intl/lib/number_format.dart ('k') | runtime/lib/immutable_map.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/collection_patch.dart
diff --git a/runtime/lib/collection_patch.dart b/runtime/lib/collection_patch.dart
index 9f0c74fad4a7efd0bc94e22c91b32e61cbf21786..6785064b4c1ab749829050f345f877b22355f454 100644
--- a/runtime/lib/collection_patch.dart
+++ b/runtime/lib/collection_patch.dart
@@ -422,7 +422,8 @@ class _HashMapEntry {
_HashMapEntry(this.key, this.value, this.hashCode, this.next);
}
-abstract class _HashMapIterable<E> extends IterableBase<E> {
+abstract class _HashMapIterable<E> extends IterableBase<E>
+ implements EfficientLength {
final HashMap _map;
_HashMapIterable(this._map);
int get length => _map.length;
@@ -812,7 +813,8 @@ class _LinkedHashMapEntry extends _HashMapEntry {
}
}
-class _LinkedHashMapKeyIterable<K> extends IterableBase<K> {
+class _LinkedHashMapKeyIterable<K> extends IterableBase<K>
+ implements EfficientLength {
LinkedHashMap<K, dynamic> _map;
_LinkedHashMapKeyIterable(this._map);
Iterator<K> get iterator => new _LinkedHashMapKeyIterator<K>(_map);
@@ -822,7 +824,8 @@ class _LinkedHashMapKeyIterable<K> extends IterableBase<K> {
int get length => _map.length;
}
-class _LinkedHashMapValueIterable<V> extends IterableBase<V> {
+class _LinkedHashMapValueIterable<V> extends IterableBase<V>
+ implements EfficientLength {
LinkedHashMap<dynamic, V> _map;
_LinkedHashMapValueIterable(this._map);
Iterator<K> get iterator => new _LinkedHashMapValueIterator<V>(_map);
« no previous file with comments | « pkg/intl/lib/number_format.dart ('k') | runtime/lib/immutable_map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698