Partager via


Comparator.NaturalOrder Method

Definition

Caution

Use 'Java.Util.IComparator.NaturalOrder'. This class will be removed in a future release.

Returns a comparator that compares Comparable objects in natural order.

[Android.Runtime.Register("naturalOrder", "()Ljava/util/Comparator;", "", ApiSince=24)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T extends java.lang.Comparable<? super T>" })]
[System.Obsolete("Use 'Java.Util.IComparator.NaturalOrder'. This class will be removed in a future release.")]
public static Java.Util.IComparator? NaturalOrder ();
[<Android.Runtime.Register("naturalOrder", "()Ljava/util/Comparator;", "", ApiSince=24)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T extends java.lang.Comparable<? super T>" })>]
[<System.Obsolete("Use 'Java.Util.IComparator.NaturalOrder'. This class will be removed in a future release.")>]
static member NaturalOrder : unit -> Java.Util.IComparator

Returns

a comparator that imposes the natural ordering on Comparable objects.

Attributes

Remarks

Returns a comparator that compares Comparable objects in natural order.

The returned comparator is serializable and throws NullPointerException when comparing null.

Added in 1.8.

Java documentation for java.util.Comparator.naturalOrder().

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