Scala map and filter methods
map(func) method:
sc.parallelize(Seq(1,2,3,4,5)).map(x=>x+1).collect
/*
res0: Array[Int] = Array(2, 3, 4, 5, 6)
*/filter(func)
sc.parallelize(Seq(1,2,3,4,5)).filter(x=>x%2==0)
.collect
/*
res2: Array[Int] = Array(2, 4)
*/Last updated