jruby/jruby — pull request #115 by wpc (2012-01-25 19:27:21+00:00)
Title:  java.util.Collection#each should respect to_ary that objects defined

If you have a collection of objects that defined to_ary method, with normal ruby array you get sort of argument pattern matching when you iterate them:

```ruby
class Pair
def initialize(a, b)
@a = a
@b = b
end

def to_ary
[@a, @b]
end
end
```
```ruby
>> [Pair.new('first', 'second')].each {|a, b| p a; p b}
"first"
"second"
```
But with a java collection you do not get this behavior

```ruby
>>java.util.ArrayList.new([Pair.new('first', 'second')]).each { |a, b| p a; p b }
##
nil
```

This seems like only a little bit inconsistency. But it do give me inconvenience currently. I have java methods returns a List of Pair defines in java which has to_ary defined on them. I need call to_a on the list each time I want to map through it.