title: Efficient copy of a Map to a new Map in Scala
body: <p>My problem is the following:</p>
  
  <pre><code>for (something &lt;- someotherthing) {
      val m = in._2 // gets a scala.collection.mutable.Map[String, String] with already some values in it
  
      if (someotherotherthing) {
          m("item1") = "reset"
          m("item3") = "reset"
      }
  
      something :+= m
  }
  </code></pre>
  
  <p>I go through something and get a map of string key value pairs. I want to only reset <code>item1</code> and <code>item3</code> in some cases. However when I run this, all of the maps that are added to <code>something</code> have these two <code>resets</code>. Can I copy this map to something else and then add it so that I don't edit all of the maps at once?</p>