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

Unified Diff: sdk/lib/core/set.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/core/set.dart
diff --git a/sdk/lib/core/set.dart b/sdk/lib/core/set.dart
index 271b3898638d7923220fe51e56e2dcaaff8291f8..e15d08da2d9a4e7af7762336963da182dce25a38 100644
--- a/sdk/lib/core/set.dart
+++ b/sdk/lib/core/set.dart
@@ -166,4 +166,24 @@ abstract class Set<E> extends IterableBase<E> implements EfficientLength {
* Removes all elements in the set.
*/
void clear();
+
+ /**
+ * Create a set of the same type as this one, but with no elements.
+ *
+ * The new set has the same behavior as this set,
+ * but starts out with no elements.
+ *
+ * This method should be equivalent to `toSet()..clear()`.
+ */
+ Set<E> cloneEmpty();
+
+ /* Creates a [Set] with the same elements and behavior as this `Set`.
+ *
+ * The returned set behaves the same as this set
+ * with regard to adding and removing elements.
+ * It initially contains the same elements.
+ * If this set specifies an ordering of the elements,
+ * the returned set will have the same order.
+ */
+ Set<E> toSet();
}

Powered by Google App Engine
This is Rietveld 408576698