import org.apache.spark.{SparkConf,SparkContext}
object SimpleApp {
def matchword(ps: String): List [String]={
var list:List[String]=null
if(ps.equals("fsda"))
list:+= ps
list
}
def main(args: Array[String]) {
val conf = new SparkConf().setAppName("Simple Application")
val sc = new SparkContext(conf)
val line = sc.parallelize(List("fdsa", "dsfsf", "dwfegw", "yureq", "acvd", "fgvb"))
val words = line.flatMap(x => matchword(x))
words.foreach(println)
sc.stop()
}
}
|