📜  按值 scala 对地图进行排序 - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:31.659000             🧑  作者: Mango

代码示例1
Sort by value from least to greatest
val grades:Map[String,Int] = Map(Mike -> 100, Milly -> 69, Jason -> 85)
grades.toSeq.sortBy(_._2)
returns:
  Map(Milly -> 69, Jason -> 85, Mike -> 100)