Scala/Java integration problem: You need to share a Scala map with a Java method, or access a Java map in Scala code.
Solution
To use a Java map in Scala code, import the mapAsScalaMap method from Scala’s JavaConversions package, and perform the conversion.
Simply trying to use a Java HashMap with something like a Scala for loop won’t work. To demonstrate this, first create a simple Java HashMap: