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

Sets should only be used for unique elements. #71

Closed
wants to merge 1 commit into from

Conversation

cfcosta
Copy link

@cfcosta cfcosta commented Feb 14, 2012

Changes text about Sets, since they only store unique elements.

@bbatsov
Copy link
Collaborator

bbatsov commented Feb 14, 2012

The text is written as is to clarify that Arrays can be used as sets (they support set operations), but if you have lots of elements a Set would perform a lot better.

@cfcosta
Copy link
Author

cfcosta commented Feb 14, 2012

As long as all elements are unique. And not all Set operations are faster than it's Array counterparts, only lookup-based ones, like #find, #delete and #include?.

@bbatsov
Copy link
Collaborator

bbatsov commented Feb 14, 2012

I meant things like union, intersection, etc. I guess both entries should be expanded a bit.

@cfcosta
Copy link
Author

cfcosta commented Feb 14, 2012

Yes, that'd be good.

@bbatsov bbatsov closed this in 058bc63 Feb 14, 2012
marocchino pushed a commit to marocchino/ruby-style-guide that referenced this pull request Aug 11, 2015
shyouhei pushed a commit to shyouhei/ruby-style-guide that referenced this pull request Nov 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants