Does Scala have any collections that sort by value instead of key?

Viewed 7261

For example the following code produces the order Stock1, Stock2, Stock3

var tm = TreeMap("Stock1" -> 4.2, "Stock3" -> 3.7, "Stock2" -> 5.9)

What I'm looking for is a collection or technique that can produce the following

Stock2, Stock1, Stock3 which represents the prices in descending order

4 Answers
Related