Closed chanshing closed 3 years ago
Hmm. It appears to work for me...
import jpype
import jpype.imports
jpype.startJVM()
import java
hm = java.util.HashMap()
hm.put("A","1")
hm.put("B","2")
u = dict(hm)
print(hm) # Prints the Java hash map
print(u) # Prints a Python dict with same contents
First off, thanks for the awesome package.
I have a static Java method that returns a
HashMap<String, String>
instance. I want to know if there's a simpler way to convert it to a dict that I may be missing: