Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to convert a python list to a Java array #35

Closed
ghost opened this issue Sep 29, 2012 · 3 comments
Closed

Make it possible to convert a python list to a Java array #35

ghost opened this issue Sep 29, 2012 · 3 comments
Labels

Comments

@ghost
Copy link

ghost commented Sep 29, 2012

There is an internal function to do this, but it not accessible in Python

@tshirtman
Copy link
Member

fixed by you sir!

@danyaljj
Copy link

It's been about 6 years since this question, so lots might have changed:
I was looking for such functionality (i.e. converting python list to Java array), but didn't find anything in the documentation.

@danyaljj
Copy link

Found the functionality; would be super-helpful to add such examples to the documentation.

>>> jArray = autoclass("java.lang.reflect.Array")
>>> a = jArray.newInstance(jString, 10)
>>> a
[None, None, None, None, None, None, None, None, None, None]
>>> a[0] = jString("nitish")
>>> a
[<java.lang.String at 0x103d619b0 jclass=java/lang/String jself=<LocalRef obj=0x7fc665f4a3f8 at 0x103abf190>>, None, None, None, None, None, None, None, None, None]

This wasn't trivial at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants