public final class AvgOf extends NumberEnvelope
Here is how you can use it to fine mathematical average of numbers:
int sum = new AvgOf(1, 2, 3, 4).intValue(); long sum = new AvgOf(1L, 2L, 3L).longValue(); int sum = new AvgOf(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.
Scalar.NoNulls<T>
Constructor and Description |
---|
AvgOf(Double... src)
Ctor.
|
AvgOf(Float... src)
Ctor.
|
AvgOf(Integer... src)
Ctor.
|
AvgOf(Iterable<Scalar<Number>> src)
Ctor.
|
AvgOf(Long... src)
Ctor.
|
AvgOf(Scalar<Number>... src)
Ctor.
|
doubleValue, floatValue, intValue, longValue, value
byteValue, shortValue
public AvgOf(Integer... src)
src
- Numberspublic AvgOf(Long... src)
src
- Numberspublic AvgOf(Double... src)
src
- Numberspublic AvgOf(Float... src)
src
- Numbers@SafeVarargs public AvgOf(Scalar<Number>... src)
src
- NumbersCopyright © 2017–2018 Cactoos. All rights reserved.