val words:Array[String]=Array("hello tom hello jim","hello hatno hello 菲菲")
words.map(x=>x.split(" "))
.flatten
.groupBy(x=>x)
.map(wdKV=>(wdKV._1,wdKV._2.length))
.toList.sortBy(t=>t._2)
.foreach(t=>println(t))
val words:Array[String]=Array("hello tom hello jim","hello hatno hello 菲菲")
words.map(x=>x.split(" "))
.flatten
.groupBy(x=>x)
.map(wdKV=>(wdKV._1,wdKV._2.length))
.toList.sortBy(t=>t._2)
.foreach(t=>println(t))