I can update a mutable.Map value with +=:
scala> val map = mutable.Map[Int,Int]()
map: scala.collection.mutable.Map[Int,Int] = Map()
scala> map(5) = 5
scala> map
res55: scala.collection.mutable.Map[Int,Int] = Map(5 -> 5)
scala> map(5) += 1
scala> map
res57: scala.collection.mutable.Map[Int,Int] = Map(5 -> 6)
But I can't use += with getOrElseUpdate and I don't understand why:
scala> map.getOrElseUpdate(5, 0) += 1
<console>:16: error: value += is not a member of Int
Expression does not convert to assignment because receiver is not assignable.
map.getOrElseUpdate(5, 0) += 1
^
I know I've used a mutable.SortedMap with mutable.ArrayBuffer values before and it let me use that type's += operation with getOrElseUpdate with no problem. Is there something like mutable.Int that I'm supposed to use?