Interface DoubleAdder
- All Known Implementing Classes:
AtomicLongDoubleAdder,JreDoubleAdder
public interface DoubleAdder
Interface mirroring the
DoubleAdder API, with implementation
that varies based on availability of DoubleAdder. This offers
compatibility for Android 21 without compromising performance in runtimes where DoubleAdder 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:
-
Method Summary
Modifier and TypeMethodDescriptionvoidadd(double x) Add the given value.default doubleEquivalent tosum().default floatReturns thesum()as afloatafter a narrowing primitive conversion.default intintValue()Returns thesum()as aintafter a narrowing primitive conversion.default longReturns thesum()as alongafter a narrowing primitive conversion.voidreset()Resets the variables maintaining the sum to zero.doublesum()Returns the current sum.double
-
Method Details
-
add
void add(double x) Add the given value.- Parameters:
x- the value to add- See Also:
-
sum
double sum()Returns the current sum.- See Also:
-
reset
void reset()Resets the variables maintaining the sum to zero.- See Also:
-
sumThenReset
double sumThenReset()- Returns:
- the sum
- See Also:
-
longValue
default long longValue()Returns thesum()as alongafter a narrowing primitive conversion.- See Also:
-
intValue
default int intValue()Returns thesum()as aintafter a narrowing primitive conversion.- See Also:
-
floatValue
default float floatValue()Returns thesum()as afloatafter a narrowing primitive conversion.- See Also:
-
doubleValue
default double doubleValue()Equivalent tosum().- Returns:
- the sum
- See Also:
-