Movatterモバイル変換


[0]ホーム

URL:


Scala 3
3.7.4
LearnInstallPlaygroundFind A LibraryCommunityBlog
Scala 3
LearnInstallPlaygroundFind A LibraryCommunityBlog
DocsAPI
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL
Scala 3/scala/scala.util/Sorting

Sorting

scala.util.Sorting
objectSorting

TheSorting object provides convenience wrappers forjava.util.Arrays.sort. Methods that defer tojava.util.Arrays.sort say that they do or under what conditions that they do.

Sorting also implements a general-purpose quicksort and stable (merge) sort for those cases wherejava.util.Arrays.sort could only be used at the cost of a large memory penalty. If performance rather than memory usage is the primary concern, one may wish to find alternate strategies to usejava.util.Arrays.sort directly e.g. by boxing primitives to use a custom ordering on them.

Sorting provides methods where you can provide a comparison function, or can request a sort of items that arescala.math.Ordered or that otherwise have an implicit or explicitscala.math.Ordering.

Note also that high-performance non-default sorts for numeric types are not provided. If this is required, it is advisable to investigate other libraries that cover this use case.

Attributes

Source
Sorting.scala
Graph
Supertypes
classObject
traitMatchable
classAny
Self type
Sorting.type

Members list

Value members

Concrete methods

Sort an array of Doubles usingjava.util.Arrays.sort.

Sort an array of Doubles usingjava.util.Arrays.sort.

Attributes

Source
Sorting.scala

Sort an array of Ints usingjava.util.Arrays.sort.

Sort an array of Ints usingjava.util.Arrays.sort.

Attributes

Source
Sorting.scala

Sort an array of Floats usingjava.util.Arrays.sort.

Sort an array of Floats usingjava.util.Arrays.sort.

Attributes

Source
Sorting.scala

Sort arraya with quicksort, using the Ordering on its elements.

Sort arraya with quicksort, using the Ordering on its elements. This algorithm sorts in place, so no additional memory is used aside from what might be required to box individual elements during comparison.

Attributes

Source
Sorting.scala

Sort arraya using the Ordering on its elements, preserving the original ordering where possible.

Sort arraya using the Ordering on its elements, preserving the original ordering where possible. Usesjava.util.Arrays.sort unlessK is a primitive type. This is the same asstableSort(a, 0, a.length).

Attributes

Source
Sorting.scala
defstableSort[K :Ordering](a:Array[K],from:Int,until:Int):Unit

Sort arraya or a part of it using the Ordering on its elements, preserving the original ordering where possible.

Sort arraya or a part of it using the Ordering on its elements, preserving the original ordering where possible. Usesjava.util.Arrays.sort unlessK is a primitive type.

Value parameters

a

The array to sort

from

The first index in the array to sort

until

The last index (exclusive) in the array to sort

Attributes

Source
Sorting.scala
defstableSort[K](a:Array[K],f: (K,K)=>Boolean):Unit

Sort arraya using functionf that computes the less-than relation for each element.

Sort arraya using functionf that computes the less-than relation for each element. Usesjava.util.Arrays.sort unlessK is a primitive type. This is the same asstableSort(a, f, 0, a.length).

Attributes

Source
Sorting.scala
defstableSort[K](a:Array[K],f: (K,K)=>Boolean,from:Int,until:Int):Unit

Sort arraya or a part of it using functionf that computes the less-than relation for each element.

Sort arraya or a part of it using functionf that computes the less-than relation for each element. Usesjava.util.Arrays.sort unlessK is a primitive type.

Value parameters

a

The array to sort

f

A function that computes the less-than relation for each element

from

The first index in the array to sort

until

The last index (exclusive) in the array to sort

Attributes

Source
Sorting.scala

A sorted Array, using the Ordering for the elements in the sequencea.

A sorted Array, using the Ordering for the elements in the sequencea. Usesjava.util.Arrays.sort unlessK is a primitive type.

Attributes

Source
Sorting.scala
defstableSort[K :ClassTag](a:Seq[K],f: (K,K)=>Boolean):Array[K]

A sorted Array, given a functionf that computes the less-than relation for each item in the sequencea.

A sorted Array, given a functionf that computes the less-than relation for each item in the sequencea. Usesjava.util.Arrays.sort unlessK is a primitive type.

Attributes

Source
Sorting.scala
defstableSort[K :ClassTag,M :Ordering](a:Seq[K],f:K=>M):Array[K]

A sorted Array, given an extraction functionf that returns an ordered key for each item in the sequencea.

A sorted Array, given an extraction functionf that returns an ordered key for each item in the sequencea. Usesjava.util.Arrays.sort unlessK is a primitive type.

Attributes

Source
Sorting.scala
In this article
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL

[8]ページ先頭

©2009-2025 Movatter.jp