OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.collection; | 5 part of dart.collection; |
6 | 6 |
7 class HashSet<E> extends Collection<E> implements Set<E> { | 7 class HashSet<E> extends Collection<E> implements Set<E> { |
8 static const int _INITIAL_CAPACITY = 8; | 8 static const int _INITIAL_CAPACITY = 8; |
9 final _HashTable<E> _table; | 9 final _HashTable<E> _table; |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 void retainWhere(bool test(E element)) { | 80 void retainWhere(bool test(E element)) { |
81 _filterWhere(test, false); | 81 _filterWhere(test, false); |
82 } | 82 } |
83 | 83 |
84 void clear() { | 84 void clear() { |
85 _table._clear(); | 85 _table._clear(); |
86 } | 86 } |
87 | 87 |
88 // Set. | 88 // Set. |
89 bool isSubsetOf(Set<E> other) { | 89 bool isSubsetOf(Collection<E> other) { |
90 return IterableMixinWorkaround.isSubsetOfSet(this, other); | 90 // Deprecated, and using old signature. |
| 91 Set otherSet; |
| 92 if (other is Set) { |
| 93 otherSet = other; |
| 94 } else { |
| 95 otherSet = other.toSet(); |
| 96 } |
| 97 return IterableMixinWorkaround.setContainsAll(otherSet, this); |
91 } | 98 } |
92 | 99 |
93 bool containsAll(Set<E> other) { | 100 bool containsAll(Iterable<E> other) { |
94 return IterableMixinWorkaround.isSubsetOfSet(other, this); | 101 return IterableMixinWorkaround.setContainsAll(this, other); |
95 } | 102 } |
96 | 103 |
97 Set<E> intersection(Set<E> other) { | 104 Set<E> intersection(Set<E> other) { |
98 return IterableMixinWorkaround.setIntersection( | 105 return IterableMixinWorkaround.setIntersection( |
99 this, other, new HashSet<E>()); | 106 this, other, new HashSet<E>()); |
100 } | 107 } |
101 | 108 |
102 Set<E> union(Set<E> other) { | 109 Set<E> union(Set<E> other) { |
103 return IterableMixinWorkaround.setUnion(this, other, new HashSet<E>()); | 110 return IterableMixinWorkaround.setUnion(this, other, new HashSet<E>()); |
104 } | 111 } |
105 | 112 |
106 Set<E> difference(Set<E> other) { | 113 Set<E> difference(Set<E> other) { |
107 return IterableMixinWorkaround.setDifference(this, other, new HashSet<E>()); | 114 return IterableMixinWorkaround.setDifference(this, other, new HashSet<E>()); |
108 } | 115 } |
109 | 116 |
110 String toString() => Collections.collectionToString(this); | 117 String toString() => Collections.collectionToString(this); |
111 } | 118 } |
OLD | NEW |