scala: best way to merge two mutable maps of mutable sets
<p>What is the best way in scala to merge two mutable maps of mutable sets?  The operation must be commutative.  The things I've tried seem ugly...</p>

<pre><code>import scala.collection.mutable
var d1 = mutable.Map[String, mutable.SortedSet[String]]()
var d2 = mutable.Map[String, mutable.SortedSet[String]]()

// adding some elements.  Accumulating nimals with the set of sounds they make.
d1.getOrElseUpdate("dog", mutable.SortedSet[String]("woof"))
d2.getOrElseUpdate("cow", mutable.SortedSet[String]("moo"))
d2.getOrElseUpdate("dog", mutable.SortedSet[String]("woof", "bark"))
</code></pre>

<p><em>magic</em> (that is commutative!)</p>

<pre><code>scala.collection.mutable.Map[String,scala.collection.mutable.SortedSet[String]] =
Map(dog -&gt; TreeSet(bark, woof), cow -&gt; TreeSet(moo))
</code></pre>

<p>Basically, I want to override the definition for ++ to merge the sets for matching map keys.  Notice that 
    d1 ++ d2 gives the right answer, while d2 ++ d1 does not (so ++ is not commutative here).</p>