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

Unified Diff: tool/input_sdk/lib/core/set.dart

Issue 1952903003: Update object.dart and some comments. (Closed) Base URL: https://github.com/dart-lang/dev_compiler@master
Patch Set: Created 4 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
« no previous file with comments | « tool/input_sdk/lib/core/object.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tool/input_sdk/lib/core/set.dart
diff --git a/tool/input_sdk/lib/core/set.dart b/tool/input_sdk/lib/core/set.dart
index bf829812520211cf906920301f86f036a340540e..5d11b04712dce4fea7c10ae2299407ffcb50a86f 100644
--- a/tool/input_sdk/lib/core/set.dart
+++ b/tool/input_sdk/lib/core/set.dart
@@ -31,7 +31,7 @@ part of dart.core;
* iterating either the set itself or any [Iterable] that is backed by the set,
* such as the ones returned by methods like [where] and [map].
*/
-abstract class Set<E> extends IterableBase<E> implements EfficientLength {
+abstract class Set<E> extends Iterable<E> implements EfficientLength {
/**
* Creates an empty [Set].
*
@@ -88,9 +88,25 @@ abstract class Set<E> extends IterableBase<E> implements EfficientLength {
bool contains(Object value);
/**
- * Adds [value] into the set. Returns `true` if [value] was added to the set.
+ * Adds [value] to the set.
*
- * If [value] already exists, the set is not changed and `false` is returned.
+ * Returns `true` if [value] (or an equal value) was not yet in the set.
+ * Otherwise returns `false` and the set is not changed.
+ *
+ * Example:
+ *
+ * var set = new Set();
+ * var time1 = new DateTime.fromMillisecondsSinceEpoch(0);
+ * var time2 = new DateTime.fromMillisecondsSinceEpoch(0);
+ * // time1 and time2 are equal, but not identical.
+ * Expect.isTrue(time1 == time2);
+ * Expect.isFalse(identical(time1, time2));
+ * set.add(time1); // => true.
+ * // A value equal to time2 exists already in the set, and the call to
+ * // add doesn't change the set.
+ * set.add(time2); // => false.
+ * Expect.isTrue(set.length == 1);
+ * Expect.isTrue(identical(time1, set.first));
*/
bool add(E value);
« no previous file with comments | « tool/input_sdk/lib/core/object.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698