This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 10.28, “How to Sort a Scala Collection”
You want to sort a sequential collection. Or, you want to implement the
Ordered trait in a custom class so you can use the sorted method, or operators like
>= to compare instances of your class.