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

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

Issue 12391010: Make HashSet.length constant time. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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
Index: sdk/lib/collection/splay_tree.dart
diff --git a/sdk/lib/collection/splay_tree.dart b/sdk/lib/collection/splay_tree.dart
index 4e8362f7c38bf200a0235f92db5a1130ca811b1a..bd2361d1b1c5b82e31a85e6f75fa31ec94f3124b 100644
--- a/sdk/lib/collection/splay_tree.dart
+++ b/sdk/lib/collection/splay_tree.dart
@@ -474,12 +474,16 @@ abstract class _SplayTreeIterator<T> implements Iterator<T> {
class _SplayTreeKeyIterable<K> extends Iterable<K> {
_SplayTree<K> _tree;
_SplayTreeKeyIterable(this._tree);
+ int get length => _tree._count;
+ bool get isEmpty => _tree._count == 0;
Iterator<K> get iterator => new _SplayTreeKeyIterator<K>(_tree);
}
class _SplayTreeValueIterable<K, V> extends Iterable<V> {
SplayTreeMap<K, V> _map;
_SplayTreeValueIterable(this._map);
+ int get length => _map._count;
+ bool get isEmpty => _map._count == 0;
Iterator<V> get iterator => new _SplayTreeValueIterator<K, V>(_map);
}

Powered by Google App Engine
This is Rietveld 408576698