scala.util

Sorting

object Sorting

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 scala.math.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.

Source
Sorting.scala
Version

1.0

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Sorting
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  15. final def notify(): Unit

    Definition Classes
    AnyRef
  16. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  17. def quickSort(a: Array[Float]): Unit

    Quickly sort an array of Floats.

  18. def quickSort(a: Array[Int]): Unit

    Quickly sort an array of Ints.

  19. def quickSort[K](a: Array[K])(implicit arg0: math.Ordering[K]): Unit

    Quickly sort an array of items with an implicit Ordering.

  20. def quickSort(a: Array[Double]): Unit

    Quickly sort an array of Doubles.

  21. def stableSort[K, M](a: Seq[K], f: (K) ⇒ M)(implicit arg0: ClassTag[K], arg1: math.Ordering[M]): Array[K]

    Stably sorts a sequence of items given an extraction function that will return an ordered key from an item.

    Stably sorts a sequence of items given an extraction function that will return an ordered key from an item.

    a

    the sequence to be sorted.

    f

    the comparison function.

    returns

    the sorted sequence of items.

  22. def stableSort[K](a: Seq[K])(implicit arg0: ClassTag[K], arg1: math.Ordering[K]): Array[K]

    Sorts an arbitrary sequence of items that are viewable as ordered.

  23. def stableSort[K](a: Seq[K], f: (K, K) ⇒ Boolean)(implicit arg0: ClassTag[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.

    Sorts an arbitrary sequence into an array, given a comparison function that should return true iff parameter one is strictly less than parameter two.

    a

    the sequence to be sorted.

    f

    the comparison function.

    returns

    the sorted sequence of items.

  24. def stableSort[K](a: Array[K], f: (K, K) ⇒ Boolean)(implicit arg0: ClassTag[K]): Unit

    Sorts an array of K given an ordering function f.

    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.

  25. def stableSort[K](a: Array[K])(implicit arg0: ClassTag[K], arg1: math.Ordering[K]): Unit

    Sort an array of K where K is Ordered, preserving the existing order where the values are equal.

  26. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  27. def toString(): String

    Definition Classes
    AnyRef → Any
  28. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped