require 'java'
require 'benchmark'

length = 50
reps   = 50000

list  = java.util.ArrayList.new
length.times { |i| list.add(i) }
array = list.toArray

Benchmark.bmbm do |b|
  b.report("        list.to_a")  { reps.times { list.to_a }}
  b.report("list.toArray.to_a")  { reps.times { list.toArray.to_a }}
  b.report("       array.to_a")  { reps.times { array.to_a }}
end

