compareTo

@ExperimentalSince(version = KotoolsTypesVersion.V4_5_2)
operator fun compareTo(other: Byte): Int

Compares this number with the other one for order. Returns zero if this number equals the other one, a negative number if it's less than the other one, or a positive number if it's greater than the other one.


Calling from Kotlin

Here's an example of calling this function from Kotlin code:

val zero = Zero()
val other: Byte = 1
val actual: Boolean = zero < other // or zero.compareTo(other) < 0
assertTrue(actual)

Calling from Java

Here's an example of calling this function from Java code:

final Zero zero = new Zero();
final byte other = 1;
final boolean actual = zero.compareTo(other) < 0;
Assertions.assertTrue(actual);

@ExperimentalSince(version = KotoolsTypesVersion.V4_5_2)
operator fun compareTo(other: Short): Int

Compares this number with the other one for order. Returns zero if this number equals the other one, a negative number if it's less than the other one, or a positive number if it's greater than the other one.


Calling from Kotlin

Here's an example of calling this function from Kotlin code:

val zero = Zero()
val other: Short = 1
val actual: Boolean = zero < other // or zero.compareTo(other) < 0
assertTrue(actual)

Calling from Java

Here's an example of calling this function from Java code:

final Zero zero = new Zero();
final short other = 1;
final boolean actual = zero.compareTo(other) < 0;
Assertions.assertTrue(actual);

@ExperimentalSince(version = KotoolsTypesVersion.V4_5_2)
operator fun compareTo(other: Int): Int

Compares this number with the other one for order. Returns zero if this number equals the other one, a negative number if it's less than the other one, or a positive number if it's greater than the other one.


Calling from Kotlin

Here's an example of calling this function from Kotlin code:

val zero = Zero()
val other = 1
val actual: Boolean = zero < other // or zero.compareTo(other) < 0
assertTrue(actual)

Calling from Java

Here's an example of calling this function from Java code:

final Zero zero = new Zero();
final int other = 1;
final boolean actual = zero.compareTo(other) < 0;
Assertions.assertTrue(actual);

@ExperimentalSince(version = KotoolsTypesVersion.V4_5_2)
operator fun compareTo(other: Long): Int

Compares this number with the other one for order. Returns zero if this number equals the other one, a negative number if it's less than the other one, or a positive number if it's greater than the other one.


Calling from Kotlin

Here's an example of calling this function from Kotlin code:

val zero = Zero()
val other: Long = 1
val actual: Boolean = zero < other // or zero.compareTo(other) < 0
assertTrue(actual)

Calling from Java

Here's an example of calling this function from Java code:

final Zero zero = new Zero();
final long other = 1;
final boolean actual = zero.compareTo(other) < 0;
Assertions.assertTrue(actual);

@ExperimentalSince(version = KotoolsTypesVersion.V4_5_2)
operator fun compareTo(other: Float): Int

Compares this number with the other one for order. Returns zero if this number equals the other one, a negative number if it's less than the other one, or a positive number if it's greater than the other one.


Calling from Kotlin

Here's an example of calling this function from Kotlin code:

val zero = Zero()
val other = 0.01f
val actual: Boolean = zero < other // or zero.compareTo(other) < 0
assertTrue(actual)

Calling from Java

Here's an example of calling this function from Java code:

final Zero zero = new Zero();
final float other = 0.01f;
final boolean actual = zero.compareTo(other) < 0;
Assertions.assertTrue(actual);

@ExperimentalSince(version = KotoolsTypesVersion.V4_5_2)
operator fun compareTo(other: Double): Int

Compares this number with the other one for order. Returns zero if this number equals the other one, a negative number if it's less than the other one, or a positive number if it's greater than the other one.


Calling from Kotlin

Here's an example of calling this function from Kotlin code:

val zero = Zero()
val other = 0.01
val actual: Boolean = zero < other // or zero.compareTo(other) < 0
assertTrue(actual)

Calling from Java

Here's an example of calling this function from Java code:

final Zero zero = new Zero();
final double other = 0.01;
final boolean actual = zero.compareTo(other) < 0;
Assertions.assertTrue(actual);