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

document that first element is kept when using Array#uniq and #uniq! #845

Closed
wants to merge 1 commit into from

Conversation

riffraff
Copy link
Contributor

@riffraff riffraff commented Mar 5, 2015

It's not guaranteed in the docs that for the method works like this:

    [1,2,3,4,5].uniq {|x| x.odd? }  #=> [1, 2]

but there is a test for it in test_array.rb and jruby seems to also visit array elements in order.

@riffraff
Copy link
Contributor Author

riffraff commented Mar 5, 2015

also, the documentation for Array#& hints at this ("The order is preserved from the original array")

@hsbt hsbt closed this in 05d1196 Mar 7, 2015
mmasaki pushed a commit to mmasaki/ruby that referenced this pull request May 30, 2015
  Array#uniq and #uniq! [fix rubyGH-845][ci skip]
  Patch by @riffraff

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
@riffraff riffraff deleted the master branch November 15, 2017 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant