minus
Subtracts the other integer from this one.
Calling from Kotlin
Here's an example of calling this function from Kotlin code:
val x: NonNegativeInteger = NonNegativeInteger.fromLong(42)
val y: NonPositiveInteger = NonPositiveInteger.fromLong(-8)
val result: NonNegativeInteger = x - y
val expected: NonNegativeInteger = NonNegativeInteger.fromLong(50)
check(result == expected)Content copied to clipboard
Calling from Java
Here's an example of calling this function from Java code:
final NonNegativeInteger x = NonNegativeInteger.fromLong(42L);
final NonPositiveInteger y = NonPositiveInteger.fromLong(-8L);
final NonNegativeInteger result = x.minus(y);
final NonNegativeInteger expected = NonNegativeInteger.fromLong(50L);
final boolean check = result.equals(expected);
if (!check) throw new IllegalStateException("Check failed.");Content copied to clipboard