Mutable TreeMap ignores multiplicities when adding another Map with ++=
Closed this issue · 2 comments
Toromtomtom commented
I noticed that adding elements to a mutable TreeMap with ++= adds only one element from each bucket.
import scala.collection.mutable
implicit val config = mutable.TreeBag.configuration.compact[Int]
val x1 = mutable.TreeBag.from(1 -> 1)
val x2 = mutable.TreeBag.from(3 -> 3)
x1 ++= x2
println(x1)
This produces Bag(1; 3), but I would expect it to produce Bag(1; 3, 3, 3) instead. Using ++ works, by the way.
Toromtomtom commented
OK, seems like that is a problem with my dependency management. When I execute the above code in your project, it produces the expected results. But in other projects that download multisets as a dependency from Maven Central, I get the wrong output.
Toromtomtom commented
OK, seems like this was fixed in c82126e, but not released yet.