how to sort a list in Scala by two fields, in this example I will sort by lastName and firstName?
case class Row(var firstName: String, var lastName: String,
In general, if you use a stable sorting algorithm, you can just sort by one key, then the next.
rows.sortBy(_.firstName).sortBy(_.lastName)
The final result will be sorted by lastname, then where that is equal, by firstname.