共用方式為


IMapEntry.ComparingByKey Method

Definition

Overloads

ComparingByKey()

Returns a comparator that compares Map.Entry in natural order on key.

ComparingByKey(IComparator)

Returns a comparator that compares Map.Entry by key using the given Comparator.

ComparingByKey()

Returns a comparator that compares Map.Entry in natural order on key.

[Android.Runtime.Register("comparingByKey", "()Ljava/util/Comparator;", "", ApiSince=24)]
[Java.Interop.JavaTypeParameters(new System.String[] { "K extends java.lang.Comparable<? super K>", "V" })]
public static Java.Util.IComparator ComparingByKey ();
[<Android.Runtime.Register("comparingByKey", "()Ljava/util/Comparator;", "", ApiSince=24)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "K extends java.lang.Comparable<? super K>", "V" })>]
static member ComparingByKey : unit -> Java.Util.IComparator

Returns

a comparator that compares Map.Entry in natural order on key.

Attributes

Remarks

Returns a comparator that compares Map.Entry in natural order on key.

The returned comparator is serializable and throws NullPointerException when comparing an entry with a null key.

Added in 1.8.

Java documentation for java.util.Map.Entry.comparingByKey().

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

ComparingByKey(IComparator)

Returns a comparator that compares Map.Entry by key using the given Comparator.

[Android.Runtime.Register("comparingByKey", "(Ljava/util/Comparator;)Ljava/util/Comparator;", "", ApiSince=24)]
[Java.Interop.JavaTypeParameters(new System.String[] { "K", "V" })]
public static Java.Util.IComparator ComparingByKey (Java.Util.IComparator cmp);
[<Android.Runtime.Register("comparingByKey", "(Ljava/util/Comparator;)Ljava/util/Comparator;", "", ApiSince=24)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "K", "V" })>]
static member ComparingByKey : Java.Util.IComparator -> Java.Util.IComparator

Parameters

cmp
IComparator

the key Comparator

Returns

a comparator that compares Map.Entry by the key.

Attributes

Remarks

Returns a comparator that compares Map.Entry by key using the given Comparator.

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

Added in 1.8.

Java documentation for java.util.Map.Entry.comparingByKey(java.util.Comparator<? super K>).

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