共用方式為


IComparator.NullsFirst(IComparator) Method

Definition

Returns a null-friendly comparator that considers null to be less than non-null.

[Android.Runtime.Register("nullsFirst", "(Ljava/util/Comparator;)Ljava/util/Comparator;", "", ApiSince=24)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public static Java.Util.IComparator? NullsFirst (Java.Util.IComparator? comparator);
[<Android.Runtime.Register("nullsFirst", "(Ljava/util/Comparator;)Ljava/util/Comparator;", "", ApiSince=24)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
static member NullsFirst : Java.Util.IComparator -> Java.Util.IComparator

Parameters

comparator
IComparator

a Comparator for comparing non-null values

Returns

a comparator that considers null to be less than non-null, and compares non-null objects with the supplied Comparator.

Attributes

Remarks

Returns a null-friendly comparator that considers null to be less than non-null. When both are null, they are considered equal. If both are non-null, the specified Comparator is used to determine the order. If the specified comparator is null, then the returned comparator considers all non-null values to be equal.

The returned comparator is serializable if the specified comparator is serializable.

Added in 1.8.

Java documentation for java.util.Comparator.nullsFirst(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