public final class SumOf extends Number
Here is how you can use it to summarize numbers:
int sum = new SumOf(1, 2, 3, 4).intValue(); long sum = new SumOf(1L, 2L, 3L).longValue(); int sum = new SumOf(numbers.toArray(new Integer[numbers.size()])).intValue();
This class implements Scalar
, which throws a checked
Exception
. This may not be convenient in many cases. To make
it more convenient and get rid of the checked exception you can
use UncheckedScalar
or IoCheckedScalar
decorators.
There is no thread-safety guarantee.
Constructor and Description |
---|
SumOf(Double... src)
Ctor.
|
SumOf(Float... src)
Ctor.
|
SumOf(Integer... src)
Ctor.
|
SumOf(Iterable<Number> src)
Ctor.
|
SumOf(Long... src)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
double |
doubleValue() |
float |
floatValue() |
int |
intValue() |
long |
longValue() |
byteValue, shortValue
public SumOf(Integer... src)
src
- Numberspublic SumOf(Long... src)
src
- Numberspublic SumOf(Double... src)
src
- Numberspublic SumOf(Float... src)
src
- Numberspublic float floatValue()
floatValue
in class Number
public double doubleValue()
doubleValue
in class Number
Copyright © 2017 Cactoos. All rights reserved.