title: How to use getOrElseUpdate in scala.collection.mutable.HashMap?
body: <p>The example code counts each word's occurrences in given input file:</p>
  
  <pre><code>object Main {
    def main(args: Array[String]) {
      val counts = new scala.collection.mutable.HashMap[String, Int]
      val in = new Scanner(new File("input.txt"))
  
      while (in.hasNext()) {
        val s: String = in.next()
        counts(s) = counts.getOrElse(s, 0) + 1 // Here!
      }
  
      print(counts)
    }
  }
  </code></pre>
  
  <p>Can the highlighted with comment line be rewritten using the <code>getOrElseUpdate</code> method?</p>
  
  <p>P.S. I am only at the 4th part of the "Scala for the impatient", so please don't teach me now about functional Scala which, I am sure, can be more beautiful here.</p>
  
  <p>Thanks.</p>