Class Product

    • Method Detail

      • create

        public static Product create()
        Creates an instance.

        The initial result is one.

        Returns:
        Product instance.
      • of

        public static Product of​(double... values)
        Returns an instance populated using the input values.

        The result is NaN if any of the values is NaN or the product at any point is a NaN.

        When the input is an empty array, the result is one.

        Parameters:
        values - Values.
        Returns:
        Product instance.
      • ofRange

        public static Product ofRange​(double[] values,
                                      int from,
                                      int to)
        Returns an instance populated using the specified range of values.

        The result is NaN if any of the values is NaN or the product at any point is a NaN.

        When the range is empty, the result is one.

        Parameters:
        values - Values.
        from - Inclusive start of the range.
        to - Exclusive end of the range.
        Returns:
        Product instance.
        Throws:
        IndexOutOfBoundsException - if the sub-range is out of bounds
        Since:
        1.2
      • of

        public static Product of​(int... values)
        Returns an instance populated using the input values.

        When the input is an empty array, the result is one.

        Parameters:
        values - Values.
        Returns:
        Product instance.
      • ofRange

        public static Product ofRange​(int[] values,
                                      int from,
                                      int to)
        Returns an instance populated using the specified range of values.

        When the range is empty, the result is one.

        Parameters:
        values - Values.
        from - Inclusive start of the range.
        to - Exclusive end of the range.
        Returns:
        Product instance.
        Throws:
        IndexOutOfBoundsException - if the sub-range is out of bounds
        Since:
        1.2
      • of

        public static Product of​(long... values)
        Returns an instance populated using the input values.

        When the input is an empty array, the result is one.

        Parameters:
        values - Values.
        Returns:
        Product instance.
      • ofRange

        public static Product ofRange​(long[] values,
                                      int from,
                                      int to)
        Returns an instance populated using the specified range of values.

        When the range is empty, the result is one.

        Parameters:
        values - Values.
        from - Inclusive start of the range.
        to - Exclusive end of the range.
        Returns:
        Product instance.
        Throws:
        IndexOutOfBoundsException - if the sub-range is out of bounds
        Since:
        1.2
      • accept

        public void accept​(double value)
        Updates the state of the statistic to reflect the addition of value.
        Specified by:
        accept in interface DoubleConsumer
        Parameters:
        value - Value.
      • getAsDouble

        public double getAsDouble()
        Gets the product of all input values.

        When no values have been added, the result is one.

        Specified by:
        getAsDouble in interface DoubleSupplier
        Returns:
        product of all values.