使用 scala 实现单机版 WordCount
1、定义一个list,这个list里面模拟一行一行的文本数据val lines = List("hello aa bb cc ", "hello dd ee ff aa ", "hello kk hh jj")2、用map函数对lines按照空格进行切割val lineword = lines.map(_.split(" "))3、用flatten函数对lineword进行“压平”val words
原创
2017-10-31 21:39:36 ·
389 阅读 ·
0 评论