IComparator.NaturalOrder Method

Definition

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>" })]
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>" })>]
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