Skip to content

Instantly share code, notes, and snippets.

@cowboyd
Created November 30, 2010 22:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cowboyd/722571 to your computer and use it in GitHub Desktop.
Save cowboyd/722571 to your computer and use it in GitHub Desktop.
convert native java arraylist to ruby array.
require 'java'
list = java.util.ArrayList.new
list.add(1)
list.add(2)
puts list.inspect #=> <Java::JavaUtil::ArrayList:0x7dc21ece>
puts list.to_a.inspect #=> [1, 2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment