Created
June 17, 2011 01:36
-
-
Save xuwei-k/1030701 to your computer and use it in GitHub Desktop.
Listのsortのてすとぉーーーー
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
def sortTest{ | |
val list = List(1,8,3,5,0) | |
println( list.sorted ) //List(0, 1, 3, 5, 8) | |
implicit val ascOrdering = new Ordering[Int]{ | |
def compare(x:Int,y:Int) = if( x > y ) -1 else if( x < y) +1 else 0 | |
} | |
println( list.sorted ) //List(8, 5, 3, 1, 0) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment