Abstraction of types which support a binary addition operator x + y. For numeric types, this is just familiar numeric addition. For String, it is string concatenation.

Integer next = current + 1;
String helloWorld = "hello" + " " + "world";

A concrete class that implements this interface should be a mathematical semigroup. That is, the addition operation should be associative, satisfying:

  • (x+y)+z == x+(y+z)

A Summable type might be a monoid, that is, a semigroup with an additive identity element, usually denoted 0, but this is not required. For example:

  • String is a monoid with identity element "",
  • Float is a monoid with identity element 0.0, and
  • Integer is a monoid with identity element 0.

For any monoid, the addition operation must satisfy:

  • x + 0 == x
By: Gavin
See also String, Numeric

no type hierarchy

no supertypes hierarchy

Inherited Attributes
Attributes inherited from: Object
plusSource Codeshared formal Other plus(Other other)

The result of adding the given value to this value. This operation should never perform any kind of mutation upon either the receiving value or the argument value.

For any two instances x and y of a type that implements Summable, x.plus(y) may be written as:

x + y
Inherited Methods
Methods inherited from: Object