RDD[ x : Vector[String] ] to RDD[x: Vector[String] + Iterator : Vector[String] ]
<p>DocsRDD : </p>

<pre><code>RDD[Vector[String]]
</code></pre>

<p>DocsRDD :</p>

<pre><code>Vector(Doc1.txt, Doc2.txt, Doc5.txt)
Vector(Doc4.txt, Doc3.txt)
Vector(Doc6.txt, Doc9.txt)
</code></pre>

<p>What I want is Just all the Dual pairs of docs, for example for DocsRDD i want</p>

<p>AllDualDocsRDD :</p>

<pre><code>Vector(Doc1.txt, Doc2.txt)
Vector(Doc1.txt, Doc5.txt)
Vector(Doc2.txt, Doc5.txt)
Vector(Doc4.txt, Doc3.txt)
Vector(Doc6.txt, Doc9.txt)
</code></pre>

<p>Below is a sample of my code(I am new to Spark,Scala).</p>

<pre><code>val AllDualDocsRDD = DocsRDD.map(e =&gt; if (e.size &gt; 2) {
                            val V_iter = (1 to e.size).flatMap(e.combinations).filter(_.size == 2).toVector
                            V_iter.foreach(println)
                            //Here I Cannot put V_iter : scala.Vector[Vector[String]]
                        }
                        else e)
</code></pre>

<p>But it seems i have hit the wall! Does anyone know how i can achieve this?</p>