I am new to Scala, trying to integrate some existing Java code with Scala-specific functionality in the Play Framework.
val scalaMap = getScalaMap() // returns Map[String,Seq[String]]
What is a nice clean way to convert scalaMap to use Java collections?
val javaMap = ??? // java.util.Map<String,List<String>>
It looks like I want to use JavaConversions, but I’m not sure how to chain together the nested collections. Thanks!
Try this:
It does the job in two steps:
first converts
Map[String,Seq[String]]toMap[String,java.util.List[String]]then the whole map to Java
Map:java.util.Map[String,java.util.List[String]].