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[Float]) : Unit
Quickly sort an array of Floats.
|
def
|
quickSort
(a : Array[Double]) : Unit
Quickly sort an array of Doubles.
|
def
|
quickSort
(a : Array[Int]) : Unit
Quickly sort an array of Ints.
|
def
|
quickSort
[K](a : Array[K])(implicit evidence$2 : (K) => Ordered[K]) : Unit
Quickly sort an array of items that are viewable as ordered.
|
implicit def
|
seq2RichSort
[K <: Ordered[K]](s : Seq[K])(implicit evidence$1 : ClassManifest[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 : Seq[K])(implicit evidence$7 : (K) => Ordered[K], implicit evidence$8 : ClassManifest[K]) : Array[K]
Sorts an arbitrary sequence of items that are viewable as ordered.
|
def
|
stableSort
[K](a : Seq[K], f : (K, K) => Boolean)(implicit evidence$6 : ClassManifest[K]) : 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, M](a : Seq[K], f : (K) => M)(implicit evidence$9 : ClassManifest[K], implicit evidence$10 : (M) => Ordered[M]) : Array[K]
Stably sorts a sequence of items given an extraction function that will
return an ordered key from an item.
|
def
|
stableSort
[K](a : Array[K])(implicit evidence$3 : (K) => Ordered[K], implicit evidence$4 : ClassManifest[K]) : Unit
Sort an array of K where K is Ordered, preserving the existing order
where the values are equal.
|
def
|
stableSort
[K](a : Array[K], f : (K, K) => Boolean)(implicit evidence$5 : ClassManifest[K]) : 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. |
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 |
implicit
def
seq2RichSort[K <: Ordered[K]](s : Seq[K])(implicit
evidence$1 : ClassManifest[K]) : RichSorting[K]
def
stableSort[K](a : Array[K])(implicit
evidence$3 : (K) => Ordered[K], implicit
evidence$4 : ClassManifest[K]) : Unit
def
stableSort[K](a : Array[K], f : (K, K) => Boolean)(implicit
evidence$5 : ClassManifest[K]) : Unit
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)(implicit
evidence$6 : ClassManifest[K]) : Array[K]
true
iff parameter one is strictly less
than parameter two.a -
the sequence to be sorted.f -
the comparison function.
def
stableSort[K](a : Seq[K])(implicit
evidence$7 : (K) => Ordered[K], implicit
evidence$8 : ClassManifest[K]) : Array[K]
def
stableSort[K, M](a : Seq[K], f : (K) => M)(implicit
evidence$9 : ClassManifest[K], implicit
evidence$10 : (M) => Ordered[M]) : Array[K]
a -
the sequence to be sorted.f -
the comparison function.
def
main(args : Array[java.lang.String]) : Unit
Scala Library
|
|