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

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

Issue 12413023: "Reverting 19985" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « sdk/lib/collection/collections.dart ('k') | sdk/lib/collection/linked_hash_set.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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
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(Collection<E> other) { 89 bool isSubsetOf(Set<E> other) {
90 // Deprecated, and using old signature. 90 return IterableMixinWorkaround.isSubsetOfSet(this, other);
91 Set otherSet;
92 if (other is Set) {
93 otherSet = other;
94 } else {
95 otherSet = other.toSet();
96 }
97 return IterableMixinWorkaround.setContainsAll(otherSet, this);
98 } 91 }
99 92
100 bool containsAll(Iterable<E> other) { 93 bool containsAll(Set<E> other) {
101 return IterableMixinWorkaround.setContainsAll(this, other); 94 return IterableMixinWorkaround.isSubsetOfSet(other, this);
102 } 95 }
103 96
104 Set<E> intersection(Set<E> other) { 97 Set<E> intersection(Set<E> other) {
105 return IterableMixinWorkaround.setIntersection( 98 return IterableMixinWorkaround.setIntersection(
106 this, other, new HashSet<E>()); 99 this, other, new HashSet<E>());
107 } 100 }
108 101
109 Set<E> union(Set<E> other) { 102 Set<E> union(Set<E> other) {
110 return IterableMixinWorkaround.setUnion(this, other, new HashSet<E>()); 103 return IterableMixinWorkaround.setUnion(this, other, new HashSet<E>());
111 } 104 }
112 105
113 Set<E> difference(Set<E> other) { 106 Set<E> difference(Set<E> other) {
114 return IterableMixinWorkaround.setDifference(this, other, new HashSet<E>()); 107 return IterableMixinWorkaround.setDifference(this, other, new HashSet<E>());
115 } 108 }
116 109
117 String toString() => Collections.collectionToString(this); 110 String toString() => Collections.collectionToString(this);
118 } 111 }
OLDNEW
« no previous file with comments | « sdk/lib/collection/collections.dart ('k') | sdk/lib/collection/linked_hash_set.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698