Condividi tramite


Integer.Compare(Int32, Int32) Method

Definition

Compares two int values numerically.

[Android.Runtime.Register("compare", "(II)I", "")]
public static int Compare (int x, int y);
[<Android.Runtime.Register("compare", "(II)I", "")>]
static member Compare : int * int -> int

Parameters

x
Int32

the first int to compare

y
Int32

the second int to compare

Returns

the value 0 if x == y; a value less than 0 if x < y; and a value greater than 0 if x > y

Attributes

Remarks

Compares two int values numerically. The value returned is identical to what would be returned by:

Integer.valueOf(x).compareTo(Integer.valueOf(y))

Added in 1.7.

Java documentation for java.lang.Integer.compare(int, int).

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