title: Invalid scala map.span() function result
body: <p>From the code bellow (scala 2.12.2) I would expect to have the following result:</p>
  
  <pre><code>(Map(aa -&gt; 1, ab -&gt; 1, ac -&gt; 1),Map(ba -&gt; 2, bb -&gt; 2, bc -&gt; 2))
  </code></pre>
  
  <p>but I am having the following:</p>
  
  <pre><code>(Map(),Map(ba -&gt; 2, bc -&gt; 2, ab -&gt; 1, ac -&gt; 1, aa -&gt; 1, bb -&gt; 2))
  </code></pre>
  
  <p>Why am I wrong? </p>
  
  <pre><code>scala&gt; val map = Map("aa"-&gt;1,"ab"-&gt;1,"ac"-&gt;1,"ba"-&gt;2,"bb"-&gt;2,"bc"-&gt;2)
  map: scala.collection.immutable.Map[String,Int] = Map(ba -&gt; 2, bc -&gt; 2, ab -&gt; 1, ac -&gt; 1, aa -&gt; 1, bb -&gt; 2)
  
  scala&gt; map.foreach(p=&gt;if (p._1.startsWith("a")) println(p._1))
  ab
  ac
  aa
  
  scala&gt; map.span(p=&gt; p._1.startsWith("a"))
  res30: (scala.collection.immutable.Map[String,Int], scala.collection.immutable.Map[String,Int]) = (Map(),Map(ba -&gt; 2, bc -&gt; 2, ab -&gt; 1, ac -&gt; 1, aa -&gt; 1, bb -&gt; 2))
  </code></pre>