Skip to content

Instantly share code, notes, and snippets.

@Qiming-C
Created January 26, 2022 19:42
Show Gist options
  • Save Qiming-C/401aa8992e202402007a705342bade1c to your computer and use it in GitHub Desktop.
Save Qiming-C/401aa8992e202402007a705342bade1c to your computer and use it in GitHub Desktop.
sortList on scala
val aList = List(3,5,2,7)
val sortedList = aList.sorted
//if we want backward
given decendingOrdering: Ordering[Int] = Ordering.fromLessThan(_ > _) //same as (a,b) => a > b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment