I use the following command to fill an RDD with a bunch of arrays containing 2 strings [\"filename\", \"content\"].
Now I want to iterate over every of those occurre
for (element <- YourRDD) { // do what you want with element in each iteration, and if you want the index of element, simply use a counter variable in this loop beginning from 0 println (element._1) // this will print all filenames }