val javaMap = new java.util.HashMap[String, Int]() javaMap.put("Cake", 4) import scala.collection.JavaConversions._ import scala.collection.mutable.Map val map: Map[String, Int] = mapAsScalaMap(javaMap) map.get("Dave") // Returns: res2: Option[Int] = None // This does not compile: // scala> map.get(4) // :14: error: type mismatch; // found : map.type (with underlying type scala.collection.mutable.Map[String,Int]) // required: ?{val get(x$1: ?>: Int(4) <: Any): ?}