标签:map cli new play eve imp pac name gif
package com.ghc.bigdata import org.apache.spark.{SparkConf,SparkContext} /** * Created by Yu Li on 12/6/2017. */ object SparkScalaApp { def main(args:Array[String]):Unit={ val sparkConf:SparkConf=new SparkConf() sparkConf.setAppName("Spark Scala App") sparkConf.setMaster("local[2]") val sc:SparkContext=new SparkContext(sparkConf) println("2 在List中的位置: "+getPosition(List(1,2,3),2)) for(i<- map[Int,String](List(1,2,3),{num:Int=>num+"2"})){ println(i) } } def getPosition[A](l:List[A],v:A): Int ={ l.indexOf(v) } def map[A,B](list:List[A],func: A=>B)=list.map(func) }
标签:map cli new play eve imp pac name gif
原文地址:http://www.cnblogs.com/Frank99/p/7991812.html