How do I sort an array in Scala?

后端 未结 7 706
北恋
北恋 2020-12-07 12:54

I can see there\'s a sorting object, Sorting, with a quicksort method, quickSort, on it.

What would be a code example of using it, sorting

7条回答
  •  再見小時候
    2020-12-07 13:52

    I prefer to user Sorting util

    Example :

    val arr = Array(7,5,1, 9,2)
    
    scala.util.Sorting.quickSort(arr)
    

    please read this for more info Sorting util

提交回复
热议问题