IComparator.ThenComparing Method

Definition

Overloads

ThenComparing(IFunction)

Returns a lexicographic-order comparator with a function that extracts a Comparable sort key.

ThenComparing(IComparator)

Returns a lexicographic-order comparator with another comparator.

ThenComparing(IFunction, IComparator)

Returns a lexicographic-order comparator with a function that extracts a key to be compared with the given Comparator.

ThenComparing(IFunction)

Returns a lexicographic-order comparator with a function that extracts a Comparable sort key.

[Android.Runtime.Register("thenComparing", "(Ljava/util/function/Function;)Ljava/util/Comparator;", "GetThenComparing_Ljava_util_function_Function_Handler:Java.Util.IComparator, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=24)]
[Java.Interop.JavaTypeParameters(new System.String[] { "U extends java.lang.Comparable<? super U>" })]
public virtual Java.Util.IComparator? ThenComparing (Java.Util.Functions.IFunction? keyExtractor);
[<Android.Runtime.Register("thenComparing", "(Ljava/util/function/Function;)Ljava/util/Comparator;", "GetThenComparing_Ljava_util_function_Function_Handler:Java.Util.IComparator, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=24)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "U extends java.lang.Comparable<? super U>" })>]
abstract member ThenComparing : Java.Util.Functions.IFunction -> Java.Util.IComparator
override this.ThenComparing : Java.Util.Functions.IFunction -> Java.Util.IComparator

Parameters

keyExtractor
IFunction

the function used to extract the Comparable sort key

Returns

a lexicographic-order comparator composed of this and then the Comparable sort key.

Attributes

Remarks

Returns a lexicographic-order comparator with a function that extracts a Comparable sort key.

Added in 1.8.

Java documentation for java.util.Comparator.thenComparing(java.util.function.Function<? super T, ? extends U>).

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

ThenComparing(IComparator)

Returns a lexicographic-order comparator with another comparator.

[Android.Runtime.Register("thenComparing", "(Ljava/util/Comparator;)Ljava/util/Comparator;", "GetThenComparing_Ljava_util_Comparator_Handler:Java.Util.IComparator, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=24)]
public virtual Java.Util.IComparator? ThenComparing (Java.Util.IComparator? other);
[<Android.Runtime.Register("thenComparing", "(Ljava/util/Comparator;)Ljava/util/Comparator;", "GetThenComparing_Ljava_util_Comparator_Handler:Java.Util.IComparator, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=24)>]
abstract member ThenComparing : Java.Util.IComparator -> Java.Util.IComparator
override this.ThenComparing : Java.Util.IComparator -> Java.Util.IComparator

Parameters

other
IComparator

the other comparator to be used when this comparator compares two objects that are equal.

Returns

a lexicographic-order comparator composed of this and then the other comparator

Attributes

Remarks

Returns a lexicographic-order comparator with another comparator. If this Comparator considers two elements equal, i.e. compare(a, b) == 0, other is used to determine the order.

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

Added in 1.8.

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

ThenComparing(IFunction, IComparator)

Returns a lexicographic-order comparator with a function that extracts a key to be compared with the given Comparator.

[Android.Runtime.Register("thenComparing", "(Ljava/util/function/Function;Ljava/util/Comparator;)Ljava/util/Comparator;", "GetThenComparing_Ljava_util_function_Function_Ljava_util_Comparator_Handler:Java.Util.IComparator, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=24)]
[Java.Interop.JavaTypeParameters(new System.String[] { "U" })]
public virtual Java.Util.IComparator? ThenComparing (Java.Util.Functions.IFunction? keyExtractor, Java.Util.IComparator? keyComparator);
[<Android.Runtime.Register("thenComparing", "(Ljava/util/function/Function;Ljava/util/Comparator;)Ljava/util/Comparator;", "GetThenComparing_Ljava_util_function_Function_Ljava_util_Comparator_Handler:Java.Util.IComparator, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=24)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "U" })>]
abstract member ThenComparing : Java.Util.Functions.IFunction * Java.Util.IComparator -> Java.Util.IComparator
override this.ThenComparing : Java.Util.Functions.IFunction * Java.Util.IComparator -> Java.Util.IComparator

Parameters

keyExtractor
IFunction

the function used to extract the sort key

keyComparator
IComparator

the Comparator used to compare the sort key

Returns

a lexicographic-order comparator composed of this comparator and then comparing on the key extracted by the keyExtractor function

Attributes

Remarks

Returns a lexicographic-order comparator with a function that extracts a key to be compared with the given Comparator.

Added in 1.8.

Java documentation for java.util.Comparator.thenComparing(java.util.function.Function<? super T, ? extends U>, java.util.Comparator<? super U>).

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