次の方法で共有


Collections.Sort Method

Definition

Overloads

Sort(IList)

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

Sort(IList, IComparator)

Sorts the specified list according to the order induced by the specified comparator.

Sort(IList)

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

[Android.Runtime.Register("sort", "(Ljava/util/List;)V", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T extends java.lang.Comparable<? super T>" })]
public static void Sort (System.Collections.IList list);
[<Android.Runtime.Register("sort", "(Ljava/util/List;)V", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T extends java.lang.Comparable<? super T>" })>]
static member Sort : System.Collections.IList -> unit

Parameters

list
IList

the list to be sorted.

Attributes

Remarks

Sorts the specified list into ascending order, according to the Comparable natural ordering of its elements. All elements in the list must implement the Comparable interface. Furthermore, all elements in the list must be mutually comparable (that is, e1.compareTo(e2) must not throw a ClassCastException for any elements e1 and e2 in the list).

This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort.

The specified list must be modifiable, but need not be resizable.

Java documentation for java.util.Collections.sort(java.util.List<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(IList, IComparator)

Sorts the specified list according to the order induced by the specified comparator.

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

Parameters

list
IList

the list to be sorted.

c
IComparator

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

Attributes

Remarks

Sorts the specified list according to the order induced by the specified comparator. All elements in the list must be mutually comparable using the specified comparator (that is, c.compare(e1, e2) must not throw a ClassCastException for any elements e1 and e2 in the list).

This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort.

The specified list must be modifiable, but need not be resizable.

Java documentation for java.util.Collections.sort(java.util.List<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