deeshank
deeshank

Reputation: 4486

Python List in Java

I'm using XMLRPC calls from java to python.

So my server in python has these remote method and use apache xmlrpc lib in java to make the calls.

So i always prefered to use Dictionary to return from the calls. Cause when i used dictionary, Object data type in java, was directly printing my valueset returned from python. Then i used Map to iterate.

Now i 've to return list in one of the methods. I couldn convert Object to List/ArrayList/HashMap.

need help... How to convert Python List in Java?

Sample Output:

{hello=1, list=[Ljava.lang.Object;@1ba9f7}

Upvotes: 0

Views: 1927

Answers (1)

DNA
DNA

Reputation: 42617

It looks like the conversion worked correctly - [Ljava.lang.Object;@1ba9f7 is the default way that a Java array (not List) of Objects is printed out. Not very helpful, but there you go...

You could convert it to a Java List using Arrays.asList(mylist). See the JavaDoc.

Or try printing out the items in the array using:

for (Object obj: myArray)
{ 
   System.out.println(obj);
}

Upvotes: 2

Related Questions