title: Scala: map a Map to list of tuples
body: <p>I tried to use Map.map to convert a map into a List of Tuples.
  However this fails. I did the following experiments:</p>
  
  <pre><code>val m = Map(("a" -&gt; 1), ("b" -&gt; 2))
           //&gt; m  :     scala.collection.immutable.Map[String,Int] = Map(a -&gt; 1, b -&gt; 2)
  val r1 = m.map{ case (k,v) =&gt; v}                //&gt; r1  : scala.collection.immutable.Iterable[Int] = List(1, 2)
  def toTuple[A,B](a:A,b:B) = (a,b)               //&gt; toTuple: [A, B](a: A, b: B)(A, B)
  //val r2: List[Tuple2[_,_]] = m.map(e =&gt; (e._1,e._2))
  val r3 = m.map(e =&gt; toTuple(e._1,e._2))         //&gt; r3  : scala.collection.immutable.Map[String,Int] = Map(a -&gt; 1, b -&gt; 2)
  val r4 = m.toSeq                                //&gt; r4  : Seq[(String, Int)] = ArrayBuffer((a,1), (b,2))
  </code></pre>
  
  <p>Notice how a List is generated for single elements (r1) but a Map is produced for tuples (r3). Not even forcing the type worked (r2). Only an explicit call to Seq did it (r4) So my question is, why/how does Map.map "automagically" create a new Map and not a list for example? In fact how is the return type determined (Seq, List, etc.)</p>