List("python","java","python","java","spark")我们可以给每个单词分配一个值 1;List(("python",1),("java",1),("python",...List(("python",2),("java",2),("spark",1))OUT的类型,我们可以指定成一个List ,里面的元素类型,还是一个元组(String,Int)还需要重写里面的方法。...List[(String, Int)] = this.result.toList}数据结果sum=List((wahaha,1), (java,5), (shell,4), (hello,2), (python...(shell -> List((shell,2), (shell,2)), wahaha -> List((wahaha,1)), java -> List((java,1), (java,4)), python...-> List((python,1)), hello -> List((hello,1), (hello,1)))