Interface LongAdder
-
- All Known Implementing Classes:
AtomicLongLongAdder,JreLongAdder
public interface LongAdderInterface mirroring theLongAdderAPI, with implementation that varies based on availability ofLongAdder. This offers compatibility for Android 21 without compromising performance in runtimes whereLongAdderis 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.createLongAdder()
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidadd(long x)Add the given value.default voiddecrement()Equivalent toadd(-1).default doubledoubleValue()Returns thesum()as adoubleafter a widening primitive conversion.default floatfloatValue()Returns thesum()as afloatafter a widening primitive conversion.default voidincrement()Equivalent toadd(1).default intintValue()Returns thesum()as aintafter a narrowing primitive conversion.default longlongValue()Equivalent tosum().voidreset()Resets the variables maintaining the sum to zero.longsum()Returns the current sum.longsumThenReset()
-
-
-
Method Detail
-
increment
default void increment()
Equivalent toadd(1).- See Also:
LongAdder.add(long)
-
decrement
default void decrement()
Equivalent toadd(-1).- See Also:
LongAdder.add(long)
-
add
void add(long x)
Add the given value.- Parameters:
x- the value to add- See Also:
LongAdder.add(long)
-
sum
long sum()
Returns the current sum.- See Also:
LongAdder.sum()
-
reset
void reset()
Resets the variables maintaining the sum to zero.- See Also:
LongAdder.reset()
-
sumThenReset
long sumThenReset()
- Returns:
- the sum
- See Also:
LongAdder.sumThenReset()
-
longValue
default long longValue()
Equivalent tosum().- Returns:
- the sum
- See Also:
LongAdder.toString()
-
intValue
default int intValue()
Returns thesum()as aintafter a narrowing primitive conversion.- See Also:
LongAdder.toString()
-
floatValue
default float floatValue()
Returns thesum()as afloatafter a widening primitive conversion.- See Also:
LongAdder.toString()
-
doubleValue
default double doubleValue()
Returns thesum()as adoubleafter a widening primitive conversion.- See Also:
()
-
-