title: Update ListMap and preserve order in Scala
body: <p>I have a basic immutable ListMap that preserves the order of items nicely. However I want to update an existing key in the ListMap at some point, but the order of that specific key is lost.</p>
  
  <pre><code>val myListMap = ListMap(1 -&gt; "foo", 2 -&gt; "bar")
  val myListMap2 = myListMap.updated(1, "foo2")
  // myListMap2: ListMap[Int,String] = Map(2 -&gt; bar, 1 -&gt; foo2)
  </code></pre>
  
  <p>How can I update a ListMap without losing the position of an existing key?</p>