Scala Library


scala/util/Sorting.scala
]
object
Sorting
extends
AnyRef
The Sorting object provides functions that can sort various kinds of
objects. You can provide a comparison function, or you can request a sort
of items that are viewable as Ordered
. Some sorts that
operate directly on a subset of value types are also provided. These
implementations are derived from those in the Sun JDK.
Note that stability doesn't matter for value types, so use the quickSort
variants for those. stableSort
is intended to be used with
objects when the prior ordering should be preserved, where possible.
Method Summary  
def

main (args : Array[java.lang.String]) : Unit 
def

quickSort
(a : Array[Int]) : Unit
Quickly sort an array of Ints.

def

quickSort
(a : Array[Double]) : Unit
Quickly sort an array of Doubles.

def

quickSort
(a : Array[Float]) : Unit
Quickly sort an array of Floats.

def

quickSort
[K](a : Array[K])(implicit view$1 : (K) => Ordered[K]) : Unit
Quickly sort an array of items that are viewable as ordered.

implicit def

seq2RichSort
[K <: Ordered[K]](s : Seq[K]) : RichSorting[K]
Provides implicit access to sorting on arbitrary sequences of orderable
items. This doesn't quite work the way that I want yet  K should be
bounded as viewable, but the compiler rejects that.

def

stableSort
[K](a : Array[K], f : (K, K) => Boolean) : Unit
Sorts an array of
K given an ordering function
f . f should return true iff
its first parameter is strictly less than its second parameter. 
def

stableSort
[K](a : Seq[K], f : (K, K) => Boolean) : Array[K]
Sorts an arbitrary sequence into an array, given a comparison function
that should return
true iff parameter one is strictly less
than parameter two. 
def

stableSort
[K](a : Array[K])(implicit view$2 : (K) => Ordered[K]) : Unit
Sort an array of K where K is Ordered, preserving the existing order
where the values are equal.

def

stableSort
[K](a : Seq[K])(implicit view$3 : (K) => Ordered[K]) : Array[K]
Sorts an arbitrary sequence of items that are viewable as ordered.

def

stableSort
[K, M](a : Seq[K], f : (K) => M)(implicit view$4 : (M) => Ordered[M]) : Array[K]
Stably sorts a sequence of items given an extraction function that will
return an ordered key from an item.

Methods inherited from AnyRef  
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized 
Methods inherited from Any  
==, !=, isInstanceOf, asInstanceOf 
Method Details 
K
given an ordering function
f
. f
should return true
iff
its first parameter is strictly less than its second parameter.true
iff parameter one is strictly less
than parameter two.a 
the sequence to be sorted.f 
the comparison function.a 
the sequence to be sorted.f 
the comparison function.
def
main(args : Array[java.lang.String]) : Unit
Scala Library

