Sorting lists by various measures of goodness
You could try that: 

def sort[A, B: Ordering](data: List[A], desc: Boolean)(measure: A =&gt; B): List[A] = {
    val baseOrdering = Ordering.by(measure)
    val ordering = if (desc) baseOrdering.reverse else baseOrdering
    data.sorted(ordering)   
}


Then you do 

sort(listOfFirstClass, desc)(_.good)