Not able to covert a Array RDD into List RDD in Spark
<p>How do I convert a Array[String] RDD into List[String] RDD?</p>

<pre><code>scala&gt; val linesRDD = sc.textFile("/user/inputfiles/records.txt")
linesRDD: org.apache.spark.rdd.RDD[String] = MapPartitionsRDD[9] at textFile at &lt;console&gt;:21

scala&gt; linesRDD.collect
res17: Array[String] = Array(100,surender,CTS,CHN, 101,ajay,CTS,BNG, 102,kumar,TCS,BNG, 103,Ankit,CTS,CHN, 104,Sukanya,TCS,BNG

scala&gt; linesRDD.toList
&lt;console&gt;:24: error: value toList is not a member of org.apache.spark.rdd.RDD[String]
          linesRDD.toList
</code></pre>

<p>As you can see above that it throws error.</p>

<p>But if you can see below that , if i apply a take Action and then applying <strong>toList</strong> works </p>

<pre><code>scala&gt; linesRDD.take(2).toList
res19: List[String] = List(100,surender,CTS,CHN, 101,ajay,CTS,BNG)
</code></pre>

<p>How do I convert a Array[String] RDD into List[String] RDD?</p>