Table of Contents

Class Comparator<T>

Namespace
Java.Util
Assembly
MASES.JNet.dll
public class Comparator<T> : Comparator, IDynamicMetaObjectProvider, IJVMBridgeCore, IDisposable, IJVMBridgeBaseStatic, IComparator<T>, IJVMBridgeBase, IJVMBridgeDefinition

Type Parameters

T
Inheritance
Comparator<T>
Implements
Inherited Members
Extension Methods

Remarks

Remember to Dispose the object otherwise there is a resource leak, the object contains a reference to the the corresponding JVM object

Constructors

Comparator()

Ctor

public Comparator()

Properties

OnCompare

public Func<T, T, int> OnCompare { get; set; }

Property Value

Func<T, T, int>

OnEquals

public Func<object, bool> OnEquals { get; set; }

Property Value

Func<object, bool>

Methods

Compare(T, T)

public virtual int Compare(T arg0, T arg1)

Parameters

arg0 T

T

arg1 T

T

Returns

int

int

ComparingDouble<SuperT>(ToDoubleFunction<SuperT>)

Accepts a function that extracts a double sort key from a type T, and returns a Comparator<T> that compares by that sort key.

public static Comparator<SuperT> ComparingDouble<SuperT>(ToDoubleFunction<SuperT> keyExtractor)

Parameters

keyExtractor ToDoubleFunction<SuperT>

Returns

Comparator<SuperT>

Type Parameters

SuperT

ComparingInt<SuperT>(ToIntFunction<SuperT>)

Accepts a function that extracts an int sort key from a type T, and returns a Comparator<T> that compares by that sort key.

public static Comparator<SuperT> ComparingInt<SuperT>(ToIntFunction<SuperT> keyExtractor)

Parameters

keyExtractor ToIntFunction<SuperT>

Returns

Comparator<SuperT>

Type Parameters

SuperT

ComparingLong<SuperT>(ToLongFunction<SuperT>)

Accepts a function that extracts a long sort key from a type T, and returns a Comparator<T> that compares by that sort key.

public static Comparator<SuperT> ComparingLong<SuperT>(ToLongFunction<SuperT> keyExtractor)

Parameters

keyExtractor ToLongFunction<SuperT>

Returns

Comparator<SuperT>

Type Parameters

SuperT

Comparing<SuperT, SuperU>(Function<SuperT, SuperU>)

Accepts a function that extracts a Comparable sort key from a type T, and returns a Comparator<T> that compares by that sort key.

public static Comparator<SuperT> Comparing<SuperT, SuperU>(Function<SuperT, SuperU> keyExtractor)

Parameters

keyExtractor Function<SuperT, SuperU>

Returns

Comparator<SuperT>

Type Parameters

SuperT
SuperU

Comparing<SuperT, SuperU>(Function<SuperT, SuperU>, Comparator<SuperU>)

Accepts a function that extracts a sort key from a type T, and returns a Comparator<T> that compares by that sort key using the specified Comparator.

public static Comparator<SuperT> Comparing<SuperT, SuperU>(Function<SuperT, SuperU> keyExtractor, Comparator<SuperU> keyComparator)

Parameters

keyExtractor Function<SuperT, SuperU>
keyComparator Comparator<SuperU>

Returns

Comparator<SuperT>

Type Parameters

SuperT
SuperU

NullsFirst<SuperT>(Comparator<SuperT>)

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

public static Comparator<SuperT> NullsFirst<SuperT>(Comparator<SuperT> comparator)

Parameters

comparator Comparator<SuperT>

Returns

Comparator<SuperT>

Type Parameters

SuperT

NullsLast<SuperT>(Comparator<SuperT>)

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

public static Comparator<SuperT> NullsLast<SuperT>(Comparator<SuperT> comparator)

Parameters

comparator Comparator<SuperT>

Returns

Comparator<SuperT>

Type Parameters

SuperT