I am using the ++: operator to get a collection of two collections, but the results I get using these two methods are inconsistent:
scala> var r = Array(1, 2) r: Array[Int] = Array(1, 2) scala> r ++:= Array(3) scala> r res28: Array[Int] = Array(3, 1, 2) scala> Array(1, 2) ++: Array(3) res29: Array[Int] = Array(1, 2, 3) Why do the ++: and ++:= operators give different results? This kind of difference does not appear with the ++ operator.
The version of Scala I am using is 2.11.8.
++:and++:=is that it takes the type of the result collection from the right-hand side (in case they are not both Arrays as here, stackoverflow.com/a/24338494/14955) --- for some definition of "right-hand" in the presence of++:=.