title: How to update a mutable hashmap element in Scala?
body: <p>I wrote a function very similar to this:</p>
  
  <pre><code>def writeMyEl (x: TypeA, y: TypeB, z : TypeC) {
    if (myMutableHashMap.contains((x, y)))
      myMutableHashMap(x, y) = z else
        myMutableHashMap += (x, y) -&gt; z
  }
  </code></pre>
  
  <p>In real code Types A and B are enumerations and C is a case class. myMutableHashMap is defined as a <code>val</code> of type <code>scala.collection.mutable.HashMap[(TypeA, TypeB), TypeC]</code> inside the same class as the <code>writeMyEl</code> function.</p>
  
  <p>The Scala (2.8) compiler says:</p>
  
  <pre><code>error: too many arguments for method update: (key: (TypeA, TypeB),value: TypeC)Unit
  </code></pre>
  
  <p>What am I doing wrong?</p>