Press "Enter" to skip to content

Sorting Data In Scala

Randhir Singh walks us through several methods of sorting in Scala:

sortBy(attribute)

Here is signature

def sortBy[B](f: A => B)(implicit ord: Ordering[B]): Repr 

The sortBy function is used to sort one or more attributes.
Here is a small example.
sort based on a single attribute of the case class.

Click through for several examples.