public final class SumOf extends NumberEnvelope
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 the UncheckedScalar
decorator. Or you may use
IoCheckedScalar
to wrap it in an IOException.
There is no thread-safety guarantee.
Constructor and Description |
---|
SumOf(Double... src)
Ctor.
|
SumOf(Float... src)
Ctor.
|
SumOf(Integer... src)
Ctor.
|
SumOf(Iterable<? extends Number> src)
Ctor.
|
SumOf(Long... src)
Ctor.
|
doubleValue, floatValue, intValue, longValue, value
byteValue, shortValue
public SumOf(Integer... src)
src
- Numberspublic SumOf(Long... src)
src
- Numberspublic SumOf(Double... src)
src
- Numberspublic SumOf(Float... src)
src
- NumbersCopyright © 2017–2019 Cactoos. All rights reserved.