Per this question:
Best way to merge two maps and sum the values of same key?
I would need to use scalaz to get what I want, however I am curious if anybody knew why the below does not work as I expect?
Map(1->2.0)+(1->1.0) //Map(1->1.0)
I would expect this to result in Map(1->3.0)
. But, it appears that maps only return the last key as shown by:
Map(1->1.0, 1->3.0) //Map(1->3.0)
So, based on the documentation
Adds two or more elements to this collection and returns a new collection.
and the above, my guess is that the map might store the values, but only return the last item? This is just not my intuition of what the add should do...maybe it is an efficiency move.
Once I have more of a moment, I will take a look at the code and try to figure it out from there, but wanted to ask here in case somebody already knew?