I have just found out this syntax for a scala Map
(used here in mutable form)
val m = scala.collection.mutable.Map[String, Int]()
m("Hello") = 5
println(m) //PRINTS Map(Hello -> 5)
Now I'm not sure whether this is syntactic sugar built in to the language, or whether something more fundamental is going on here involving the fact that a map extends a PartialFunction
. Could anyone explain?