title: Passing ArrayList to Ruby as a RubyArray
body: <p>In Ruby, if you do something like</p>
  
  <pre><code>print ["Hello", 1, 2]
  </code></pre>
  
  <p>You get an output like</p>
  
  <blockquote>
    <p>["Hello" , 1 , 2]</p>
  </blockquote>
  
  <hr>
  
  <p>Have some <code>ArrayList</code> object, <code>list</code> in Java. It contains objects of type <code>Object</code>.</p>
  
  <p>I am passing this list to my Ruby code. When you print this, the console outputs something like</p>
  
  <pre><code>&lt;Java::JavaUtil::ArrayList:0x5ab077a7&gt;
  </code></pre>
  
  <p>Which is correct, of course.</p>
  
  <p>However, I would like to get the same behaviour as above. If <code>list</code> contains two objects of type <code>Object</code>, when Ruby pints it, I want to get</p>
  
  <blockquote>
    <p>[Object:0x1234567 , Object:0x21432423]</p>
  </blockquote>
  
  <p>Rather than the reference of the list itself.</p>
  
  <p>I suspect I should convert <code>list</code> to <code>RubyArray</code> before passing it to Ruby. But how?</p>