Skip to content
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 boolean if the item was added #6548

Closed
jmesserly opened this issue Nov 6, 2012 · 3 comments
Closed

Set.add should return a boolean if the item was added #6548

jmesserly opened this issue Nov 6, 2012 · 3 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-duplicate Closed in favor of an existing report library-collection type-enhancement A request for a change that isn't a bug

Comments

@jmesserly
Copy link

It would be nice to add a method to the set and also check if it is there at the same time. C# HashSet.add works like this:

http://msdn.microsoft.com/en-us/library/bb353005.aspx

This saves an extra lookup. Otherwise you need to do "if (set.contains(key)) { doSomething(); } else { set.add(key); }"

We already have "set.remove" which returns a bool :)

@jmesserly
Copy link
Author

first sentence should read "It would be nice to add an item to the set and also check if it is there at the same time."

@lrhn
Copy link
Member

lrhn commented Nov 6, 2012

Added Duplicate label.
Marked as being merged into #3546.

@dgrove
Copy link
Contributor

dgrove commented Jan 11, 2013

Removed Library-Collections label.
Added Library-Collection label.

@jmesserly jmesserly added Type-Enhancement area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-collection closed-duplicate Closed in favor of an existing report labels Jan 11, 2013
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-duplicate Closed in favor of an existing report library-collection type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants