We know that in spark there is a method rdd.collect which converts RDD to a list.
List f= rdd.collect(); String[] array = f.toArray(new String[f.si
You're looking for JavaSparkContext.parallelize(List) and similar. This is just like in the Scala API.