Concatenate two immutable maps - which elements are preferred?

Viewed 35197

When concatenating two immutable maps, it seems that the elements of the right operand will "overwrite" the elements of the left one:

scala> List((1, 2), (5, 6)).toMap ++ List((5, 9)).toMap
res13: scala.collection.immutable.Map[Int,Int] = Map(1 -> 2, 5 -> 9)

scala> List((5, 9)).toMap ++ List((1, 2), (5, 6)).toMap
res14: scala.collection.immutable.Map[Int,Int] = Map(5 -> 6, 1 -> 2)

I would like to know, if this is a rule in Scala ?

From the Scala API I could not figure out this question.

2 Answers
Related