title: Error: type mismatch flatMap
body: <p>I am new to spark programming and scala and i am not able to understand the difference between map and flatMap.
  I tried below code as i was expecting both to work but got error. </p>
  
  <pre><code>scala&gt; val b = List("1","2", "4", "5")
  b: List[String] = List(1, 2, 4, 5)
  
  scala&gt; b.map(x =&gt; (x,1))
  res2: List[(String, Int)] = List((1,1), (2,1), (4,1), (5,1))
  
  scala&gt; b.flatMap(x =&gt; (x,1))
  &lt;console&gt;:28: error: type mismatch;
   found   : (String, Int)
   required: scala.collection.GenTraversableOnce[?]
                b.flatMap(x =&gt; (x,1))
  </code></pre>
  
  <p>As per my understanding flatmap make Rdd in to collection for String/Int Rdd.
  I was thinking that in this case both should work without any error.Please let me know where i am making the mistake.</p>
  
  <p>Thanks</p>