From: David H. <dav...@gm...> - 2007-07-31 22:21:20
|
I wrote the following code for converting a Jython list-of-lists to a Java Object[][]. To get the Object[] type I construct an instance, then ask it what its type is -- is there a less roundabout way? from java.lang import Object import jarray listOfLists = [ [1, 2, 3], [2, 3, 4], [3, 4, 5] ] arrayType = jarray.array([], Object).__class__ listOfArrays = map(lambda x: jarray.array(x, Object), listOfLists) arrayOfArrays = jarray.array(listOfArrays, arrayType) Thanks, -David |