map(): Return a new distributed dataset formed by passing each element of the source through the function
Example:
val a = sc . parallelize ( List (" dog " , " salmon " , " salmon " , " rat " , " elephant") , 3)
val b = a . map ( _ . length )
val c = a . zip ( b )
c . collect
flatmap(): Similar to map, but allows emitting more than one item in the map function
Example:
val a = sc . parallelize (1 to 10 , 5)
a . flatMap (1 to _ ) . collect