I thought we can rely on implicit conversion which converts scala.Double
to java.lang.Double
. So I tried the following:
import scal
It seems that for String
, you don't need to do any conversion, but is not the case for Double
.
You can use the method double2Double
which is defined in Predef
to convert to java.double.
import scala.collection.JavaConverters._
m.map { case (k, v) => k -> double2Double(v) }.asJava
or another way is to do asInstanceOf
to convert it to Java map directly.