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

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

Issue 23859008: Convert HashSet, LinkedHashSet to factory methods and custom implementations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. 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
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 28b7ce26d204cb0e03ca7a317549e2b9ccd14c58..d9aadf2c3e54cf0993cc3d5be433b7883acb42e4 100644
--- a/sdk/lib/collection/linked_hash_set.dart
+++ b/sdk/lib/collection/linked_hash_set.dart
@@ -21,55 +21,13 @@ part of dart.collection;
* Most simple operations on `HashSet` are done in constant time: [add],
* [contains], [remove], and [length].
*/
-class LinkedHashSet<E> extends _HashSetBase<E> {
+class LinkedHashSet<E> implements HashSet<E> {
- external LinkedHashSet();
+ external factory LinkedHashSet({ bool equals(E e1, E e2),
+ int hashCode(E e),
+ bool isValidKey(potentialKey) });
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>();
}

Powered by Google App Engine
This is Rietveld 408576698