title: Spark how to transform RDD[Seq[(String, String)]] to RDD[(String, String)]
body: <p>I have a Spark RDD[Seq[(String,String)]] which contains several group of two words. Now I have to save them to a file in HDFS like this (no matter in which Seq they are):</p>
  
  <pre><code>dog cat
  cat mouse
  mouse milk
  </code></pre>
  
  <p>Could someone help me with this? Thanks a lot &lt;3</p>
  
  <p><strong>EDIT</strong>:
  Thanks for your help. Here is the solution</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>val seqTermTermRDD: RDD[Seq[(String, String)]] = ...
  val termTermRDD: RDD[(String, String)] = seqTermTermRDD.flatMap(identity)
  val combinedTermsRDD: RDD[String] = termTermRDD.map{ case(term1, term2) =&gt; term1 + " " + term2 }
  combinedTermsRDD.saveAsTextFile(outputFile)
  </code></pre>