Interface LongAdder

  • All Known Implementing Classes:
    AtomicLongLongAdder, JreLongAdder

    public interface LongAdder
    Interface mirroring the LongAdder API, with implementation that varies based on availability of LongAdder. This offers compatibility for Android 21 without compromising performance in runtimes where LongAdder 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.createLongAdder()
    • Method Detail

      • increment

        default void increment()
        Equivalent to add(1).
        See Also:
        LongAdder.add(long)
      • decrement

        default void decrement()
        Equivalent to add(-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()
        Equivalent in effect to sum() followed by reset().
        Returns:
        the sum
        See Also:
        LongAdder.sumThenReset()
      • longValue

        default long longValue()
        Equivalent to sum().
        Returns:
        the sum
        See Also:
        LongAdder.toString()
      • intValue

        default int intValue()
        Returns the sum() as a int after a narrowing primitive conversion.
        See Also:
        LongAdder.toString()
      • floatValue

        default float floatValue()
        Returns the sum() as a float after a widening primitive conversion.
        See Also:
        LongAdder.toString()
      • doubleValue

        default double doubleValue()
        Returns the sum() as a double after a widening primitive conversion.
        See Also:
        ()