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>(); |
} |