The below class causes the compiler error :
value toMap is not a member of
java.util.Map[java.lang.String,java.util.List[com.recommendations.TestObject]]
class ProcessData(var distanceMap : java.util.Map[java.lang.String , java.util.List[TestObject]]) {
def apply = {
val m2: Map[String, Any] = distanceMap.toMap
}
}
This line causes the error :
val m2: Map[String, Any] = distanceMap.toMap
Is the error because the value of Map distanceMap is an mutable java.util.List , hence these values need also be immutable ?
How can I build a Scala immutable map from the mutable distanceMap above ?