I have two files. One is scala and other is java.
Scala file has a function which returns scala immutable map.
Java file wants to use that map as dictionary.
I am a newbie to scala and java. How can I convert that scala map to java dicionary?
I have two files. One is scala and other is java.
Scala file has a function which returns scala immutable map.
Java file wants to use that map as dictionary.
I am a newbie to scala and java. How can I convert that scala map to java dicionary?
This is a better way to convert a Scala immutable.Map to a Java Map in Java.
Use the static forwarders from Java. In Scala 2.13 the API is simplified, with overloaded
asJava
for conversion to Java:Given a Scala class that returns a Scala Map: