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

Side by Side Diff: sdk/lib/collection/linked_hash_set.dart

Issue 12838002: Deprecate Set.isSubsetOf, make Set.containsAll accept iterable. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated test expectations. Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 LinkedHashSet<E> extends Collection<E> implements Set<E> { 7 class LinkedHashSet<E> extends Collection<E> implements Set<E> {
8 static const int _INITIAL_CAPACITY = 8; 8 static const int _INITIAL_CAPACITY = 8;
9 _LinkedHashTable<E> _table; 9 _LinkedHashTable<E> _table;
10 10
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 void retainWhere(bool test(E element)) { 122 void retainWhere(bool test(E element)) {
123 _filterWhere(test, false); 123 _filterWhere(test, false);
124 } 124 }
125 125
126 void clear() { 126 void clear() {
127 _table._clear(); 127 _table._clear();
128 } 128 }
129 129
130 // Set. 130 // Set.
131 bool isSubsetOf(Set<E> other) { 131 bool isSubsetOf(Collection<E> other) {
132 return IterableMixinWorkaround.isSubsetOfSet(this, other); 132 // Deprecated, and using old signature.
133 Set otherSet;
134 if (other is Set) {
135 otherSet = other;
136 } else {
137 otherSet = other.toSet();
138 }
139 return IterableMixinWorkaround.setContainsAll(otherSet, this);
133 } 140 }
134 141
135 bool containsAll(Set<E> other) { 142 bool containsAll(Iterable<E> other) {
136 return IterableMixinWorkaround.isSubsetOfSet(other, this); 143 return IterableMixinWorkaround.setContainsAll(this, other);
137 } 144 }
138 145
139 Set<E> intersection(Set<E> other) { 146 Set<E> intersection(Set<E> other) {
140 return IterableMixinWorkaround.setIntersection( 147 return IterableMixinWorkaround.setIntersection(
141 this, other, new LinkedHashSet<E>()); 148 this, other, new LinkedHashSet<E>());
142 } 149 }
143 150
144 Set<E> union(Set<E> other) { 151 Set<E> union(Set<E> other) {
145 return IterableMixinWorkaround.setUnion( 152 return IterableMixinWorkaround.setUnion(
146 this, other, new LinkedHashSet<E>()); 153 this, other, new LinkedHashSet<E>());
147 } 154 }
148 155
149 Set<E> difference(Set<E> other) { 156 Set<E> difference(Set<E> other) {
150 return IterableMixinWorkaround.setDifference( 157 return IterableMixinWorkaround.setDifference(
151 this, other, new LinkedHashSet<E>()); 158 this, other, new LinkedHashSet<E>());
152 } 159 }
153 160
154 String toString() => Collections.collectionToString(this); 161 String toString() => Collections.collectionToString(this);
155 } 162 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698