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

Unified Diff: sdk/lib/collection/splay_tree.dart

Issue 288103003: Change Set.toSet to always return a set with the same behavior. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Change .clone() to use .toSet(). Update docs. Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/collection/splay_tree.dart
diff --git a/sdk/lib/collection/splay_tree.dart b/sdk/lib/collection/splay_tree.dart
index 8e2f5930eff58f4928cc88bcafc1996a6ecf6151..e927e53d2a011ad88f8752d362e1762eecf68f6f 100644
--- a/sdk/lib/collection/splay_tree.dart
+++ b/sdk/lib/collection/splay_tree.dart
@@ -785,7 +785,7 @@ class SplayTreeSet<E> extends _SplayTree<E> with IterableMixin<E>
}
Set<E> intersection(Set<E> other) {
- Set<E> result = new SplayTreeSet<E>(_compare, _validKey);
+ Set<E> result = new SplayTreeSet<E>(_comparator, _validKey);
for (E element in this) {
if (other.contains(element)) result.add(element);
}
@@ -793,7 +793,7 @@ class SplayTreeSet<E> extends _SplayTree<E> with IterableMixin<E>
}
Set<E> difference(Set<E> other) {
- Set<E> result = new SplayTreeSet<E>(_compare, _validKey);
+ Set<E> result = new SplayTreeSet<E>(_comparator, _validKey);
for (E element in this) {
if (!other.contains(element)) result.add(element);
}
@@ -804,8 +804,12 @@ class SplayTreeSet<E> extends _SplayTree<E> with IterableMixin<E>
return _clone()..addAll(other);
}
+ SplayTreeSet<E> cloneEmpty() {
+ return new SplayTreeSet<E>(_comparator, _validKey);
+ }
+
SplayTreeSet<E> _clone() {
- var set = new SplayTreeSet<E>(_compare, _validKey);
+ var set = new SplayTreeSet<E>(_comparator, _validKey);
set._count = _count;
set._root = _cloneNode(_root);
return set;
@@ -825,4 +829,6 @@ class SplayTreeSet<E> extends _SplayTree<E> with IterableMixin<E>
}
void clear() { _clear(); }
+
+ Set<E> toSet() => _clone();
}

Powered by Google App Engine
This is Rietveld 408576698