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

Unified Diff: sdk/lib/collection/hash_set.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/hash_set.dart
diff --git a/sdk/lib/collection/hash_set.dart b/sdk/lib/collection/hash_set.dart
index 22fb38f6f792aeedd8d185b238bc464836816d4d..69080293a042a40849539d22dcd0c79410a73482 100644
--- a/sdk/lib/collection/hash_set.dart
+++ b/sdk/lib/collection/hash_set.dart
@@ -19,6 +19,8 @@ class HashSet<E> extends Collection<E> implements Set<E> {
// Iterable.
Iterator<E> get iterator => new _HashTableKeyIterator<E>(_table);
+ int get length => _table._elementCount;
+
bool get isEmpty => _table._elementCount == 0;
bool contains(Object object) => _table._get(object) >= 0;

Powered by Google App Engine
This is Rietveld 408576698