摘要:
package com /** * Created by ZX on 2016/4/5. */ object ListTest { def main(args: Array[String]) { //创建一个List val lst0 = List(1,7,9,8,0,3,5,4,6,2) //将lst0中每个元素乘以10后生成一个新的集合 val ... 阅读全文
摘要:
val lines=List("hello tom hello jerry","hello tom hello kitty hello china") //方法一: val wc=lines.flatMap(_.split(" ")).map((_,1)).groupBy(_._1).map(t=>(t._1,t._2.size)).toList.sortBy(_._2)... 阅读全文
摘要:
package com /** * Created by Administrator on 2019/4/8. */ object TestMap { def ttt(f: Int => Int): Unit = { val r = f(10) println(r) } val f0 = (x: Int) => x * x def m0(x: ... 阅读全文