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:
    AdderUtil.createDoubleAdder()
    • 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()
        Equivalent in effect to sum() followed by reset().
        Returns:
        the sum
        See Also:
        DoubleAdder.sumThenReset()
      • longValue

        default long longValue()
        Returns the sum() as a long after a narrowing primitive conversion.
        See Also:
        DoubleAdder.toString()
      • intValue

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

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

        default double doubleValue()
        Equivalent to sum().
        Returns:
        the sum
        See Also:
        DoubleAdder.toString()