Arrays.Sort Method

Definition

Overloads

Sort(Object[], Int32, Int32, IComparator)

Sorts the specified range of the specified array of objects according to the order induced by the specified comparator.

Sort(Int64[], Int32, Int32)

Sorts the specified range of the array into ascending order.

Sort(Int32[], Int32, Int32)

Sorts the specified range of the array into ascending order.

Sort(Int16[], Int32, Int32)

Sorts the specified range of the array into ascending order.

Sort(Double[], Int32, Int32)

Sorts the specified range of the array into ascending order.

Sort(Char[], Int32, Int32)

Sorts the specified range of the array into ascending order.

Sort(Byte[], Int32, Int32)

Sorts the specified range of the array into ascending order.

Sort(Object[], Int32, Int32)

Sorts the specified range of the specified array of objects into ascending order, according to the Comparable natural ordering of its elements.

Sort(Single[], Int32, Int32)

Sorts the specified range of the array into ascending order.

Sort(Object[], IComparator)

Sorts the specified array of objects according to the order induced by the specified comparator.

Sort(Int64[])

Sorts the specified array into ascending numerical order.

Sort(Int32[])

Sorts the specified array into ascending numerical order.

Sort(Int16[])

Sorts the specified array into ascending numerical order.

Sort(Double[])

Sorts the specified array into ascending numerical order.

Sort(Char[])

Sorts the specified array into ascending numerical order.

Sort(Byte[])

Sorts the specified array into ascending numerical order.

Sort(Object[])

Sorts the specified array of objects into ascending order, according to the Comparable natural ordering of its elements.

Sort(Single[])

Sorts the specified array into ascending numerical order.

Sort(Object[], Int32, Int32, IComparator)

Sorts the specified range of the specified array of objects according to the order induced by the specified comparator.

[Android.Runtime.Register("sort", "([Ljava/lang/Object;IILjava/util/Comparator;)V", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public static void Sort (Java.Lang.Object[] a, int fromIndex, int toIndex, Java.Util.IComparator? c);
[<Android.Runtime.Register("sort", "([Ljava/lang/Object;IILjava/util/Comparator;)V", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
static member Sort : Java.Lang.Object[] * int * int * Java.Util.IComparator -> unit

Parameters

a
Object[]

the array to be sorted

fromIndex
Int32

the index of the first element (inclusive) to be sorted

toIndex
Int32

the index of the last element (exclusive) to be sorted

c
IComparator

the comparator to determine the order of the array. A null value indicates that the elements' Comparable natural ordering should be used.

Attributes

Remarks

Java documentation for java.util.Arrays.sort(T[], int, int, java.util.Comparator<? super T>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Sort(Int64[], Int32, Int32)

Sorts the specified range of the array into ascending order.

[Android.Runtime.Register("sort", "([JII)V", "")]
public static void Sort (long[] a, int fromIndex, int toIndex);
[<Android.Runtime.Register("sort", "([JII)V", "")>]
static member Sort : int64[] * int * int -> unit

Parameters

a
Int64[]

the array to be sorted

fromIndex
Int32

the index of the first element, inclusive, to be sorted

toIndex
Int32

the index of the last element, exclusive, to be sorted

Attributes

Exceptions

if start > end.

if start or end > array.length.

Remarks

Java documentation for java.util.Arrays.sort(long[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Sort(Int32[], Int32, Int32)

Sorts the specified range of the array into ascending order.

[Android.Runtime.Register("sort", "([III)V", "")]
public static void Sort (int[] a, int fromIndex, int toIndex);
[<Android.Runtime.Register("sort", "([III)V", "")>]
static member Sort : int[] * int * int -> unit

Parameters

a
Int32[]

the array to be sorted

fromIndex
Int32

the index of the first element, inclusive, to be sorted

toIndex
Int32

the index of the last element, exclusive, to be sorted

Attributes

Exceptions

if start > end.

if start or end > array.length.

Remarks

Java documentation for java.util.Arrays.sort(int[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Sort(Int16[], Int32, Int32)

Sorts the specified range of the array into ascending order.

[Android.Runtime.Register("sort", "([SII)V", "")]
public static void Sort (short[] a, int fromIndex, int toIndex);
[<Android.Runtime.Register("sort", "([SII)V", "")>]
static member Sort : int16[] * int * int -> unit

Parameters

a
Int16[]

the array to be sorted

fromIndex
Int32

the index of the first element, inclusive, to be sorted

toIndex
Int32

the index of the last element, exclusive, to be sorted

Attributes

Exceptions

if start > end.

if start or end > array.length.

Remarks

Java documentation for java.util.Arrays.sort(short[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Sort(Double[], Int32, Int32)

Sorts the specified range of the array into ascending order.

[Android.Runtime.Register("sort", "([DII)V", "")]
public static void Sort (double[] a, int fromIndex, int toIndex);
[<Android.Runtime.Register("sort", "([DII)V", "")>]
static member Sort : double[] * int * int -> unit

Parameters

a
Double[]

the array to be sorted

fromIndex
Int32

the index of the first element, inclusive, to be sorted

toIndex
Int32

the index of the last element, exclusive, to be sorted

Attributes

Exceptions

if start > end.

if start or end > array.length.

Remarks

Java documentation for java.util.Arrays.sort(double[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

Applies to

Sort(Char[], Int32, Int32)

Sorts the specified range of the array into ascending order.

[Android.Runtime.Register("sort", "([CII)V", "")]
public static void Sort (char[] a, int fromIndex, int toIndex);
[<Android.Runtime.Register("sort", "([CII)V", "")>]
static member Sort : char[] * int * int -> unit

Parameters

a
Char[]

the array to be sorted

fromIndex
Int32

the index of the first element, inclusive, to be sorted

toIndex
Int32

the index of the last element, exclusive, to be sorted

Attributes

Exceptions

if start > end.

if start or end > array.length.

Remarks

Java documentation for java.util.Arrays.sort(char[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Sort(Byte[], Int32, Int32)

Sorts the specified range of the array into ascending order.

[Android.Runtime.Register("sort", "([BII)V", "")]
public static void Sort (byte[] a, int fromIndex, int toIndex);
[<Android.Runtime.Register("sort", "([BII)V", "")>]
static member Sort : byte[] * int * int -> unit

Parameters

a
Byte[]

the array to be sorted

fromIndex
Int32

the index of the first element, inclusive, to be sorted

toIndex
Int32

the index of the last element, exclusive, to be sorted

Attributes

Exceptions

if start > end.

if start or end > array.length.

Remarks

Java documentation for java.util.Arrays.sort(byte[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Sort(Object[], Int32, Int32)

Sorts the specified range of the specified array of objects into ascending order, according to the Comparable natural ordering of its elements.

[Android.Runtime.Register("sort", "([Ljava/lang/Object;II)V", "")]
public static void Sort (Java.Lang.Object[] a, int fromIndex, int toIndex);
[<Android.Runtime.Register("sort", "([Ljava/lang/Object;II)V", "")>]
static member Sort : Java.Lang.Object[] * int * int -> unit

Parameters

a
Object[]

the array to be sorted

fromIndex
Int32

the index of the first element (inclusive) to be sorted

toIndex
Int32

the index of the last element (exclusive) to be sorted

Attributes

Exceptions

if any element does not implement Comparable, or if compareTo throws for any pair of elements.

if start > end.

if start or end > array.length.

Remarks

Java documentation for java.util.Arrays.sort(java.lang.Object[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Sort(Single[], Int32, Int32)

Sorts the specified range of the array into ascending order.

[Android.Runtime.Register("sort", "([FII)V", "")]
public static void Sort (float[] a, int fromIndex, int toIndex);
[<Android.Runtime.Register("sort", "([FII)V", "")>]
static member Sort : single[] * int * int -> unit

Parameters

a
Single[]

the array to be sorted

fromIndex
Int32

the index of the first element, inclusive, to be sorted

toIndex
Int32

the index of the last element, exclusive, to be sorted

Attributes

Exceptions

if start > end.

if start or end > array.length.

Remarks

Java documentation for java.util.Arrays.sort(float[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

Applies to

Sort(Object[], IComparator)

Sorts the specified array of objects according to the order induced by the specified comparator.

[Android.Runtime.Register("sort", "([Ljava/lang/Object;Ljava/util/Comparator;)V", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public static void Sort (Java.Lang.Object[] a, Java.Util.IComparator? c);
[<Android.Runtime.Register("sort", "([Ljava/lang/Object;Ljava/util/Comparator;)V", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
static member Sort : Java.Lang.Object[] * Java.Util.IComparator -> unit

Parameters

a
Object[]

the array to be sorted

c
IComparator

the comparator to determine the order of the array. A null value indicates that the elements' Comparable natural ordering should be used.

Attributes

Remarks

Java documentation for java.util.Arrays.sort(T[], java.util.Comparator<? super T>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Sort(Int64[])

Sorts the specified array into ascending numerical order.

[Android.Runtime.Register("sort", "([J)V", "")]
public static void Sort (long[] a);
[<Android.Runtime.Register("sort", "([J)V", "")>]
static member Sort : int64[] -> unit

Parameters

a
Int64[]

the array to be sorted

Attributes

Remarks

Java documentation for java.util.Arrays.sort(long[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Sort(Int32[])

Sorts the specified array into ascending numerical order.

[Android.Runtime.Register("sort", "([I)V", "")]
public static void Sort (int[] a);
[<Android.Runtime.Register("sort", "([I)V", "")>]
static member Sort : int[] -> unit

Parameters

a
Int32[]

the array to be sorted

Attributes

Remarks

Java documentation for java.util.Arrays.sort(int[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Sort(Int16[])

Sorts the specified array into ascending numerical order.

[Android.Runtime.Register("sort", "([S)V", "")]
public static void Sort (short[] a);
[<Android.Runtime.Register("sort", "([S)V", "")>]
static member Sort : int16[] -> unit

Parameters

a
Int16[]

the array to be sorted

Attributes

Remarks

Java documentation for java.util.Arrays.sort(short[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Sort(Double[])

Sorts the specified array into ascending numerical order.

[Android.Runtime.Register("sort", "([D)V", "")]
public static void Sort (double[] a);
[<Android.Runtime.Register("sort", "([D)V", "")>]
static member Sort : double[] -> unit

Parameters

a
Double[]

the array to be sorted

Attributes

Remarks

Java documentation for java.util.Arrays.sort(double[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

  • <xref:Java.Util.Arrays.Sort(System.Double%5b%5d%2c+System.Int32%2c+System.Int32)>

Applies to

Sort(Char[])

Sorts the specified array into ascending numerical order.

[Android.Runtime.Register("sort", "([C)V", "")]
public static void Sort (char[] a);
[<Android.Runtime.Register("sort", "([C)V", "")>]
static member Sort : char[] -> unit

Parameters

a
Char[]

the array to be sorted

Attributes

Remarks

Java documentation for java.util.Arrays.sort(char[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Sort(Byte[])

Sorts the specified array into ascending numerical order.

[Android.Runtime.Register("sort", "([B)V", "")]
public static void Sort (byte[] a);
[<Android.Runtime.Register("sort", "([B)V", "")>]
static member Sort : byte[] -> unit

Parameters

a
Byte[]

the array to be sorted

Attributes

Remarks

Java documentation for java.util.Arrays.sort(byte[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Sort(Object[])

Sorts the specified array of objects into ascending order, according to the Comparable natural ordering of its elements.

[Android.Runtime.Register("sort", "([Ljava/lang/Object;)V", "")]
public static void Sort (Java.Lang.Object[] a);
[<Android.Runtime.Register("sort", "([Ljava/lang/Object;)V", "")>]
static member Sort : Java.Lang.Object[] -> unit

Parameters

a
Object[]

the array to be sorted

Attributes

Exceptions

if any element does not implement Comparable, or if compareTo throws for any pair of elements.

Remarks

Java documentation for java.util.Arrays.sort(java.lang.Object[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Sort(Single[])

Sorts the specified array into ascending numerical order.

[Android.Runtime.Register("sort", "([F)V", "")]
public static void Sort (float[] a);
[<Android.Runtime.Register("sort", "([F)V", "")>]
static member Sort : single[] -> unit

Parameters

a
Single[]

the array to be sorted

Attributes

Remarks

Java documentation for java.util.Arrays.sort(float[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

  • <xref:Java.Util.Arrays.Sort(System.Single%5b%5d%2c+System.Int32%2c+System.Int32)>

Applies to