scala函数高级操作 一.字符串高级操作 多行字符串和插值 package top.ruandb.scala.Course06 object StringApp { def main(args: Array[String]): Unit = { val str = """ |这是一个多行字符串 |hello |lucy |lallalla """.stripMargin val say ="hello" val name =…
try 表达式 var result = try{ Integer.parseInt("dog") }catch{ case _ => 0 }finally{ println("excute") } match 表达式 val code = 3 var result = code match{ case 1 => "one" case 2 => "two" case _ => "others&…
var rdd1=sc.makeRDD(Array((1,"A"),(2,"B"),(3,"C"),(4,"D")),2) rdd1.partitions.size res20:int=2 rdd1.mapPartitionsWithIndex{ (partIdx,iter)=>{ var part_map=scala.collection.mutable.Map[string,List[(Int,String)]]()…