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

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

Issue 23451045: Revert "Convert HashSet, LinkedHashSet to factory methods and custom implementations." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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/collection/hash_set.dart ('k') | sdk/lib/core/list.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/collection/linked_hash_set.dart
diff --git a/sdk/lib/collection/linked_hash_set.dart b/sdk/lib/collection/linked_hash_set.dart
index d9aadf2c3e54cf0993cc3d5be433b7883acb42e4..28b7ce26d204cb0e03ca7a317549e2b9ccd14c58 100644
--- a/sdk/lib/collection/linked_hash_set.dart
+++ b/sdk/lib/collection/linked_hash_set.dart
@@ -21,13 +21,55 @@ part of dart.collection;
* Most simple operations on `HashSet` are done in constant time: [add],
* [contains], [remove], and [length].
*/
-class LinkedHashSet<E> implements HashSet<E> {
+class LinkedHashSet<E> extends _HashSetBase<E> {
- external factory LinkedHashSet({ bool equals(E e1, E e2),
- int hashCode(E e),
- bool isValidKey(potentialKey) });
+ external LinkedHashSet();
factory LinkedHashSet.from(Iterable<E> iterable) {
return new LinkedHashSet<E>()..addAll(iterable);
}
+
+ // Iterable.
+
+ /** Return an iterator that iterates over elements in insertion order. */
+ external Iterator<E> get iterator;
+
+ external int get length;
+
+ external bool get isEmpty;
+
+ external bool get isNotEmpty;
+
+ external bool contains(Object object);
+
+ /** Perform an operation on each element in insertion order. */
+ external void forEach(void action(E element));
+
+ external E get first;
+
+ external E get last;
+
+ E get single {
+ if (length == 1) return first;
+ var message = (length == 0) ? "No Elements" : "Too many elements";
+ throw new StateError(message);
+ }
+
+ // Collection.
+ external void add(E element);
+
+ external void addAll(Iterable<E> objects);
+
+ external bool remove(Object object);
+
+ external void removeAll(Iterable objectsToRemove);
+
+ external void removeWhere(bool test(E element));
+
+ external void retainWhere(bool test(E element));
+
+ external void clear();
+
+ // Set.
+ Set<E> _newSet() => new LinkedHashSet<E>();
}
« no previous file with comments | « sdk/lib/collection/hash_set.dart ('k') | sdk/lib/core/list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698