public class LongAccumulator extends AccumulatorV2<java.lang.Long,java.lang.Long>
accumulator
for computing sum, count, and averages for 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(java.lang.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()
Adds v to the accumulator, i.e.
|
void |
merge(AccumulatorV2<java.lang.Long,java.lang.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.
|
java.lang.Long |
value()
Defines the current value of this accumulator
|
copyAndReset, id, isRegistered, name, toString, writeReplace
public boolean isZero()
isZero
in class AccumulatorV2<java.lang.Long,java.lang.Long>
public LongAccumulator copy()
AccumulatorV2
copy
in class AccumulatorV2<java.lang.Long,java.lang.Long>
public void reset()
AccumulatorV2
isZero
must
return true.reset
in class AccumulatorV2<java.lang.Long,java.lang.Long>
public void add(java.lang.Long v)
add
in class AccumulatorV2<java.lang.Long,java.lang.Long>
v
- (undocumented)public void add(long v)
v
- (undocumented)public long count()
public long sum()
public double avg()
public void merge(AccumulatorV2<java.lang.Long,java.lang.Long> other)
AccumulatorV2
merge
in class AccumulatorV2<java.lang.Long,java.lang.Long>
other
- (undocumented)public java.lang.Long value()
AccumulatorV2
value
in class AccumulatorV2<java.lang.Long,java.lang.Long>