title: Scala Immutable MultiMap
body: <p>In Scala I would like to be able to write</p>
  
  <pre><code>val petMap = ImmutableMultiMap(Alice-&gt;Cat, Bob-&gt;Dog, Alice-&gt;Hamster)
  </code></pre>
  
  <p>The underlying Map[Owner,Set[Pet]] should have both Map and Set immutable. Here's a first draft for ImmutibleMultiMap with companion object:</p>
  
  <pre><code>import collection.{mutable,immutable}
  
  class ImmutableMultiMap[K,V] extends immutable.HashMap[K,immutable.Set[V]]
  
  object ImmutableMultiMap {
    def apply[K,V](pairs: Tuple2[K,V]*): ImmutableMultiMap[K,V] = {
      var m = new mutable.HashMap[K,mutable.Set[V]] with mutable.MultiMap[K,V]
      for ((k,v) &lt;- pairs) m.addBinding(k,v)
      // How do I return the ImmutableMultiMap[K,V] corresponding to m here?
    }
  }
  </code></pre>
  
  <p>Can you resolve the comment line elegantly? Both the map and the sets should become immutable. </p>
  
  <p>Thanks!</p>