Language

ApplicationInfo.DisplayNameComparator.IComparator.Compare Method

Definition

Compares its two arguments for order.

int IComparator.Compare(Java.Lang.Object? o1, Java.Lang.Object? o2);
abstract member Java.Util.IComparator.Compare : Java.Lang.Object * Java.Lang.Object -> int
override this.Java.Util.IComparator.Compare : Java.Lang.Object * Java.Lang.Object -> int

Parameters

o1
Object

the first object to be compared.

o2
Object

the second object to be compared.

Returns

a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

Implements

Remarks

Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. The implementor must ensure that signum(compare(x, y)) == -signum(compare(y, x)) for all x and y. (This implies that compare(x, y) must throw an exception if and only if compare(y, x) throws an exception.) The implementor must also ensure that the relation is transitive: ((compare(x, y)>0) && (compare(y, z)>0)) implies compare(x, z)>0. Finally, the implementor must ensure that compare(x, y)==0 implies that signum(compare(x, z))==signum(compare(y, z)) for all z.

Java reference for java.util.Comparator.compare.

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