plus

Adds the other integer to this one.


Calling from Kotlin

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

val x: NonPositiveInteger = NonPositiveInteger.fromLong(-42)
val y: NonPositiveInteger = NonPositiveInteger.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 NonPositiveInteger y = NonPositiveInteger.fromLong(-8L);

final NonPositiveInteger result = x.plus(y);

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