import scala.io.Source
object wordcount1 {
def main(args: Array[String]): Unit = {
Source.fromFile("D:\\Big_Data\\myscala\\data\\words.txt").getLines().flatMap(_.split(",")).map((_, 1)).toList.groupBy(_._1).map(x => (x._1, x._2.map(_._2).sum)).foreach(println)
}
}
震惊!scala一行代码实现wordcount!!!
猜你喜欢
转载自blog.csdn.net/qq_45750230/article/details/107855742
今日推荐
周排行