val m = Map(0 -> 1, 100 -> 1)
m.toSeq
m.toSeq.sortWith((a, b) =>
a._2.compareTo(b._2) match {
case 0 => a._1.compareTo(b._1) > 0
case c => c > 0
}
).head
参考:
How to sort a Scala Map by key or value (sortBy, sortWith) | alvinalexander.com
Scala ソート実験(Hishidama’s Scala sort Memo)