Created
January 26, 2022 19:42
-
-
Save Qiming-C/401aa8992e202402007a705342bade1c to your computer and use it in GitHub Desktop.
sortList on scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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