plus

operator fun plus(other: Integer): Integer

Adds the other integer to this one.


Calling from Kotlin

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

// Given
val x: Integer = Integer.from(9223372036854775807)
val y: Integer = Integer.from(2)
// When
val result: Integer = x + y
// Then
val expected: Integer = Integer.fromDecimal("9223372036854775809")
check(result == expected)

Calling from Java

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

// Given
final Integer x = Integer.from(9223372036854775807L);
final Integer y = Integer.from(2);
// When
final Integer result = x.plus(y);
// Then
final Integer expected = Integer.fromDecimal("9223372036854775809");
final boolean check = result.equals(expected);
if (!check) throw new IllegalStateException("Check failed.");