-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set.add should return a bool to indicate if the value already existed #3546
Comments
Issue #4210 has been merged into this issue. |
This comment was originally written by domi...@google.com http://codereview.chromium.org/10836009/ Set owner to domi...@google.com. |
Issue #6548 has been merged into this issue. |
Removed Type-Defect label. |
Another attempt: https://codereview.chromium.org/26280002/ Set owner to @kevmoo. |
r28863 Added Fixed label. |
Set owner to @kevmoo. |
Changes: ``` > git log --format="%C(auto) %h %s" ec35d46..28a2503 https://dart.googlesource.com/pub.git/+/28a2503d Bump analyzer from 4.7.0 to 5.1.0 (#3582) https://dart.googlesource.com/pub.git/+/8dba9574 Crc32c checksum validation and retry of archive downloads (#3546) https://dart.googlesource.com/pub.git/+/27da43ec Allow `dart pub add` with existing package, update constraint instead of adding (#3570) https://dart.googlesource.com/pub.git/+/2e9338e5 Do resolution before publishing. (#3565) https://dart.googlesource.com/pub.git/+/0a487534 Migrate removed command `pub` to `dart pub` in docs & messages (#3506) https://dart.googlesource.com/pub.git/+/e2720c27 Fail gracefully when run inside the pub-cache (#3471) https://dart.googlesource.com/pub.git/+/a76c1933 Upgrade `package:tar` to 0.5.6 (#3540) https://dart.googlesource.com/pub.git/+/c065e559 Remove unnecessary nullability (#3547) https://dart.googlesource.com/pub.git/+/8e306f33 Use pub.dev in writing (#3528) https://dart.googlesource.com/pub.git/+/08d71024 Use unicode (if available) when drawing file-lists (#3541) https://dart.googlesource.com/pub.git/+/a0ca4226 Don't be conservative in upgrade --major-versions without specific pa… (#3539) https://dart.googlesource.com/pub.git/+/a59d890e Show file size (#3509) https://dart.googlesource.com/pub.git/+/b0ba5cc6 Avoid packageGraph (and therefore getExecutableForCommand) depending on the lock-file (#3533) ``` Diff: https://dart.googlesource.com/pub.git/+/ec35d46261b610e558dfd0d8525ca3fc8387b4b7~..28a2503d7f4806e6854e3ed0d783f065abfd1b5f/ Change-Id: Ia366f75da16982fb9588a0d7aa18e109daea8f8c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262346 Reviewed-by: Jonas Jensen <jonasfj@google.com> Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Similarly to Set.remove, Set.add should return a bool so one can avoid doing:
if (mySet.contains(o)) { throw 'not unique'; }
mySet.add(o);
And instead do:
if (!mySet.add(o)) { throw 'not unique'; }
The text was updated successfully, but these errors were encountered: