| Index: sdk/lib/_internal/lib/collection_patch.dart
|
| diff --git a/sdk/lib/_internal/lib/collection_patch.dart b/sdk/lib/_internal/lib/collection_patch.dart
|
| index 463fab9c4cb24ca2a7f4e62af549ed2dc1c6134d..1cccb421759554332330a7deb87d5111812b9893 100644
|
| --- a/sdk/lib/_internal/lib/collection_patch.dart
|
| +++ b/sdk/lib/_internal/lib/collection_patch.dart
|
| @@ -992,7 +992,7 @@ patch class HashSet<E> {
|
| patch factory HashSet.identity() = _IdentityHashSet<E>;
|
| }
|
|
|
| -class _HashSet<E> extends _HashSetBase<E> implements HashSet<E> {
|
| +class _HashSet<E> extends SetBase<E> implements HashSet<E> {
|
| int _length = 0;
|
|
|
| // The hash set contents are divided into three parts: one part for
|
| @@ -1016,7 +1016,7 @@ class _HashSet<E> extends _HashSetBase<E> implements HashSet<E> {
|
|
|
| _HashSet();
|
|
|
| - Set<E> _newSet() => new _HashSet<E>();
|
| + Set<E> cloneEmpty() => new _HashSet<E>();
|
|
|
| // Iterable.
|
| Iterator<E> get iterator {
|
| @@ -1126,24 +1126,6 @@ class _HashSet<E> extends _HashSetBase<E> implements HashSet<E> {
|
| return true;
|
| }
|
|
|
| - void removeAll(Iterable<Object> objectsToRemove) {
|
| - for (var each in objectsToRemove) {
|
| - remove(each);
|
| - }
|
| - }
|
| -
|
| - void retainAll(Iterable<Object> elements) {
|
| - super._retainAll(elements, (o) => o is E);
|
| - }
|
| -
|
| - void removeWhere(bool test(E element)) {
|
| - removeAll(_computeElements().where(test));
|
| - }
|
| -
|
| - void retainWhere(bool test(E element)) {
|
| - removeAll(_computeElements().where((E element) => !test(element)));
|
| - }
|
| -
|
| void clear() {
|
| if (_length > 0) {
|
| _strings = _nums = _rest = _elements = null;
|
| @@ -1286,7 +1268,7 @@ class _HashSet<E> extends _HashSetBase<E> implements HashSet<E> {
|
| }
|
|
|
| class _IdentityHashSet<E> extends _HashSet<E> {
|
| - Set<E> _newSet() => new _IdentityHashSet<E>();
|
| + Set<E> cloneEmpty() => new _IdentityHashSet<E>();
|
|
|
| int _computeHashCode(var key) {
|
| // We force the hash codes to be unsigned 30-bit integers to avoid
|
| @@ -1312,7 +1294,7 @@ class _CustomHashSet<E> extends _HashSet<E> {
|
| _CustomHashSet(this._equality, this._hasher, bool validKey(potentialKey))
|
| : _validKey = (validKey != null) ? validKey : ((x) => x is E);
|
|
|
| - Set<E> _newSet() => new _CustomHashSet<E>(_equality, _hasher, _validKey);
|
| + Set<E> cloneEmpty() => new _CustomHashSet<E>(_equality, _hasher, _validKey);
|
|
|
| int _findBucketIndex(var bucket, var element) {
|
| if (bucket == null) return -1;
|
| @@ -1347,25 +1329,6 @@ class _CustomHashSet<E> extends _HashSet<E> {
|
| if (!_validKey(object)) return false;
|
| return super._remove(object);
|
| }
|
| -
|
| - bool containsAll(Iterable<Object> elements) {
|
| - for (Object element in elements) {
|
| - if (!_validKey(element) || !this.contains(element)) return false;
|
| - }
|
| - return true;
|
| - }
|
| -
|
| - void removeAll(Iterable<Object> elements) {
|
| - for (Object element in elements) {
|
| - if (_validKey(element)) {
|
| - super._remove(element);
|
| - }
|
| - }
|
| - }
|
| -
|
| - void retainAll(Iterable<Object> elements) {
|
| - super._retainAll(elements, _validKey);
|
| - }
|
| }
|
|
|
| // TODO(kasperl): Share this code with HashMapKeyIterator<E>?
|
| @@ -1431,7 +1394,7 @@ patch class LinkedHashSet<E> {
|
| patch factory LinkedHashSet.identity() = _LinkedIdentityHashSet<E>;
|
| }
|
|
|
| -class _LinkedHashSet<E> extends _HashSetBase<E> implements LinkedHashSet<E> {
|
| +class _LinkedHashSet<E> extends SetBase<E> implements LinkedHashSet<E> {
|
| int _length = 0;
|
|
|
| // The hash set contents are divided into three parts: one part for
|
| @@ -1459,7 +1422,7 @@ class _LinkedHashSet<E> extends _HashSetBase<E> implements LinkedHashSet<E> {
|
|
|
| _LinkedHashSet();
|
|
|
| - Set<E> _newSet() => new _LinkedHashSet<E>();
|
| + Set<E> cloneEmpty() => new _LinkedHashSet<E>();
|
|
|
| void _unsupported(String operation) {
|
| throw 'LinkedHashSet: unsupported $operation';
|
| @@ -1568,12 +1531,6 @@ class _LinkedHashSet<E> extends _HashSetBase<E> implements LinkedHashSet<E> {
|
| return true;
|
| }
|
|
|
| - void addAll(Iterable<E> objects) {
|
| - for (E object in objects) {
|
| - add(object);
|
| - }
|
| - }
|
| -
|
| bool remove(Object object) {
|
| if (_isStringElement(object)) {
|
| return _removeHashTableEntry(_strings, object);
|
| @@ -1597,16 +1554,6 @@ class _LinkedHashSet<E> extends _HashSetBase<E> implements LinkedHashSet<E> {
|
| return true;
|
| }
|
|
|
| - void removeAll(Iterable objectsToRemove) {
|
| - for (var each in objectsToRemove) {
|
| - remove(each);
|
| - }
|
| - }
|
| -
|
| - void retainAll(Iterable<Object> elements) {
|
| - super._retainAll(elements, (o) => o is E);
|
| - }
|
| -
|
| void removeWhere(bool test(E element)) {
|
| _filterWhere(test, true);
|
| }
|
| @@ -1759,7 +1706,7 @@ class _LinkedHashSet<E> extends _HashSetBase<E> implements LinkedHashSet<E> {
|
| }
|
|
|
| class _LinkedIdentityHashSet<E> extends _LinkedHashSet<E> {
|
| - Set<E> _newSet() => new _LinkedIdentityHashSet<E>();
|
| + Set<E> cloneEmpty() => new _LinkedIdentityHashSet<E>();
|
|
|
| int _computeHashCode(var key) {
|
| // We force the hash codes to be unsigned 30-bit integers to avoid
|
| @@ -1787,7 +1734,7 @@ class _LinkedCustomHashSet<E> extends _LinkedHashSet<E> {
|
| bool validKey(potentialKey))
|
| : _validKey = (validKey != null) ? validKey : ((x) => x is E);
|
|
|
| - Set<E> _newSet() =>
|
| + Set<E> cloneEmpty() =>
|
| new _LinkedCustomHashSet<E>(_equality, _hasher, _validKey);
|
|
|
| int _findBucketIndex(var bucket, var element) {
|
| @@ -1839,10 +1786,6 @@ class _LinkedCustomHashSet<E> extends _LinkedHashSet<E> {
|
| }
|
| }
|
| }
|
| -
|
| - void retainAll(Iterable<Object> elements) {
|
| - super._retainAll(elements, _validKey);
|
| - }
|
| }
|
|
|
| class LinkedHashSetCell {
|
|
|