1、前置条件安装
hadoop:https://blog.csdn.net/jxq0816/article/details/78736449
scala:
https://www.runoob.com/scala/scala-install.html2、Idea安装Scala插件
3、代码
object ScalaWordCount {
def main(args: Array[String]): Unit = {
var lines = List("hello scala", "hello world","hello java")
//切分并压平
val words = lines.flatMap(_.split(" "))