#sort on Java list only works if no block is provided
-----------------------------------------------------
Key: JRUBY-2576
URL: http://jira.codehaus.org/browse/JRUBY-2576
Project: JRuby
Issue Type: Bug
Components: Java Integration
Affects Versions: JRuby 1.1.1
Reporter: Trejkaz
In trying to sort a List passed from the Java side, I noticed that this doesn't
work if I pass it a block.
a = java.util.ArrayList.new
a << "aa"
a << "ccc"
a << "b"
a.sort.inspect # ["aa", "b", "ccc"]
a.sort { a.length <=> b.length }.inspect # RaiseException
The same example works if it's a Ruby Array.
a = ["aa", "ccc", "b"]
a.sort { |a,b| a.length <=> b.length }.inspect # ["b", "aa", "ccc"]
So of course you can call #to_array to get one where it works, but I think it
would be more convenient if it worked either way.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email