public class LongAccumulator extends AccumulatorV2<Long,Long>
accumulator for computing sum, count, and average of 64-bit integers.
| Constructor and Description |
|---|
LongAccumulator() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(long v)
Adds v to the accumulator, i.e.
|
void |
add(Long v)
Adds v to the accumulator, i.e.
|
double |
avg()
Returns the average of elements added to the accumulator.
|
LongAccumulator |
copy()
Creates a new copy of this accumulator.
|
long |
count()
Returns the number of elements added to the accumulator.
|
boolean |
isZero()
Returns false if this accumulator has had any values added to it or the sum is non-zero.
|
void |
merge(AccumulatorV2<Long,Long> other)
Merges another same-type accumulator into this one and update its state, i.e.
|
void |
reset()
Resets this accumulator, which is zero value.
|
long |
sum()
Returns the sum of elements added to the accumulator.
|
Long |
value()
Defines the current value of this accumulator
|
copyAndReset, id, isRegistered, name, toStringpublic boolean isZero()
isZero in class AccumulatorV2<Long,Long>public LongAccumulator copy()
AccumulatorV2copy in class AccumulatorV2<Long,Long>public void reset()
AccumulatorV2isZero must
return true.reset in class AccumulatorV2<Long,Long>public void add(Long v)
add in class AccumulatorV2<Long,Long>v - (undocumented)public void add(long v)
v - (undocumented)public long count()
public long sum()
public double avg()
public void merge(AccumulatorV2<Long,Long> other)
AccumulatorV2merge in class AccumulatorV2<Long,Long>other - (undocumented)public Long value()
AccumulatorV2value in class AccumulatorV2<Long,Long>