Interface DoubleAdder
-
- All Known Implementing Classes:
AtomicLongDoubleAdder,JreDoubleAdder
public interface DoubleAdderInterface mirroring theDoubleAdderAPI, with implementation that varies based on availability ofDoubleAdder. This offers compatibility for Android 21 without compromising performance in runtimes whereDoubleAdderis available.This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
- See Also:
AdderUtil.createDoubleAdder()
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidadd(double x)Add the given value.default doubledoubleValue()Equivalent tosum().default floatfloatValue()Returns thesum()as afloatafter a narrowing primitive conversion.default intintValue()Returns thesum()as aintafter a narrowing primitive conversion.default longlongValue()Returns thesum()as alongafter a narrowing primitive conversion.voidreset()Resets the variables maintaining the sum to zero.doublesum()Returns the current sum.doublesumThenReset()
-
-
-
Method Detail
-
add
void add(double x)
Add the given value.- Parameters:
x- the value to add- See Also:
DoubleAdder.add(double)
-
sum
double sum()
Returns the current sum.- See Also:
DoubleAdder.sum()
-
reset
void reset()
Resets the variables maintaining the sum to zero.- See Also:
DoubleAdder.reset()
-
sumThenReset
double sumThenReset()
- Returns:
- the sum
- See Also:
DoubleAdder.sumThenReset()
-
longValue
default long longValue()
Returns thesum()as alongafter a narrowing primitive conversion.- See Also:
DoubleAdder.toString()
-
intValue
default int intValue()
Returns thesum()as aintafter a narrowing primitive conversion.- See Also:
DoubleAdder.toString()
-
floatValue
default float floatValue()
Returns thesum()as afloatafter a narrowing primitive conversion.- See Also:
DoubleAdder.toString()
-
doubleValue
default double doubleValue()
Equivalent tosum().- Returns:
- the sum
- See Also:
DoubleAdder.toString()
-
-