Save each value of an rdd as a file


Hi Sir,

Kindly let me know how the below can be achieved.
I have an RDD like below after groupByKey and converting compact buffer to list.
(45000,List(Amit, Pavan, Ratan))
(10000,List(Kumar, Venkat, Sheela))
(50000,List(Tejas, Dinesh, Lokesh, Bhupesh))

Now, i want to save each value as a file with file name as key
45000file -> data of first record and so on

Kindly let me know how to achieve this