I used a scala immutable map as per below.
val d = "4.55"
This is working fine.
val properties = Map("title"->"title" , "value" -> d )
Its convert from [String , AnyRef] to [String, Any]
val properties = Map("title"->"title" , "value" -> d.toDouble )
Cant convert from Double to Object , runtime error
val properties:Map[String,Object] = Map("title"->"title" , "value" -> d.toDouble )
Why object cant accept the Double?
Working fine.
val properties:Map[String,Object] = Map("title"->"title" , "value" -> d.toDouble.asInstanceOf[Object] )
Cant understand the four scenario of Immutable Map behaviour.
Most important of all: Scala has no primitive types as Java do.
Scala's Double is a class, inherit from AnyVal, has it's own methods
But Java's Object is the base class of all reference types, aka...Class
So, what you did here is using Object as base class of Double.
In my opinion,
Scala's AnyRef is the corresponding type to Java's Object.
Scala's AnyVal is the corresponding type to Java's Primitive Types.