Chromium Code Reviews| Index: sdk/lib/core/set.dart |
| diff --git a/sdk/lib/core/set.dart b/sdk/lib/core/set.dart |
| index 2c6b52417de05453bbd6670f27eef09cf4fca7dd..11418f757a8e43928625f87cc4d22bfb7f1acc1f 100644 |
| --- a/sdk/lib/core/set.dart |
| +++ b/sdk/lib/core/set.dart |
| @@ -88,9 +88,25 @@ abstract class Set<E> extends Iterable<E> implements EfficientLength { |
| bool contains(Object value); |
| /** |
| - * Adds [value] into the set. Returns `true` if [value] was added to the set. |
| - * |
| - * If [value] already exists, the set is not changed and `false` is returned. |
| + * Adds [value] into the set. |
|
Lasse Reichstein Nielsen
2016/02/09 16:34:53
into -> to
"add ... into" doesn't sound right. It
floitsch
2016/02/09 17:26:52
Done.
|
| + * |
| + * 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); |