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

Add mutation of #map to #to_set #1241

Open
dkubb opened this issue Jul 21, 2021 · 0 comments
Open

Add mutation of #map to #to_set #1241

dkubb opened this issue Jul 21, 2021 · 0 comments
Labels

Comments

@dkubb
Copy link
Collaborator

dkubb commented Jul 21, 2021

The Enumerable#to_set method can accept a block like Enumerable#map and it will return a Set containing unique entries.

If the return value of #map (a) Doesn't need to include duplicates or (b) Needs to be an Array because the public interface of the method says it must be an Array, then we would expect appropriate tests to ensure this property holds.

If neither of these is the case, then a Set can often function just as well as an Array, and perhaps even better if the assumption is that there can be no duplicate entries.

@dkubb dkubb added the mutation label Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant