Interface DoubleAdder
-
- All Known Implementing Classes:
AtomicLongDoubleAdder
,JreDoubleAdder
public interface DoubleAdder
Interface mirroring theDoubleAdder
API, with implementation that varies based on availability ofDoubleAdder
. This offers compatibility for Android 21 without compromising performance in runtimes whereDoubleAdder
is 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 void
add(double x)
Add the given value.default double
doubleValue()
Equivalent tosum()
.default float
floatValue()
Returns thesum()
as afloat
after a narrowing primitive conversion.default int
intValue()
Returns thesum()
as aint
after a narrowing primitive conversion.default long
longValue()
Returns thesum()
as along
after a narrowing primitive conversion.void
reset()
Resets the variables maintaining the sum to zero.double
sum()
Returns the current sum.double
sumThenReset()
-
-
-
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 along
after a narrowing primitive conversion.- See Also:
DoubleAdder.toString()
-
intValue
default int intValue()
Returns thesum()
as aint
after a narrowing primitive conversion.- See Also:
DoubleAdder.toString()
-
floatValue
default float floatValue()
Returns thesum()
as afloat
after a narrowing primitive conversion.- See Also:
DoubleAdder.toString()
-
doubleValue
default double doubleValue()
Equivalent tosum()
.- Returns:
- the sum
- See Also:
DoubleAdder.toString()
-
-