What’s the best way of converting a ruby hash to a java hashmap.
Currently I have a HashMap of ArrayLists and I’m doing my conversion
like this, which is super cumbersome
@java_map = Java::JavaUtil::HashMap.new
@ids = Java::JavaUtil::ArrayList.new
@ids.add( Java::JavaLang::Integer.new(some_fix_num) ) # for a few
items
@java_map.put( Java::JavaLang::Integer.new(some_id), @ids)
I’m calling a java function passing in the @java_map that expects this:
Map<Integer, List> javaMap
I was doing this explicitly when we had an older version of jruby
because it was throwing a type error due to this bug.
We’ve now upgraded to 1.5.3 so I’m wondering What is the preferred way
of doing this with jruby-1.5.x ??