minus

Subtracts the other integer from this one.


Calling from Kotlin

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

val x: NonPositiveInteger = NonPositiveInteger.fromLong(-42)
val y: NonNegativeInteger = NonNegativeInteger.fromLong(8)

val result: NonPositiveInteger = x - y

val expected: NonPositiveInteger = NonPositiveInteger.fromLong(-50)
check(result == expected)

Calling from Java

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

final NonPositiveInteger x = NonPositiveInteger.fromLong(-42L);
final NonNegativeInteger y = NonNegativeInteger.fromLong(8L);

final NonPositiveInteger result = x.minus(y);

final NonPositiveInteger expected = NonPositiveInteger.fromLong(-50L);
final boolean check = result.equals(expected);
if (!check) throw new IllegalStateException("Check failed.");