Class DoubleSummary

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long count()
      Returns the count of values recorded.
      boolean equals​(Object obj)  
      int hashCode()  
      double max()
      Return the maximum value recorded, or Double.NEGATIVE_INFINITY if no values have been recorded.
      static double max​(double[] values)
      Return the maximum value of the given double array.
      double mean()
      Return the arithmetic mean of values recorded, or zero if no values have been recorded.
      static double mean​(double[] values)
      Returns a double describing the arithmetic mean of the values, or Double.NaN if the values array is empty.
      double min()
      Return the minimum value recorded, or Double.POSITIVE_INFINITY if no values have been recorded.
      static double min​(double[] values)
      Return the minimum value of the given double array.
      static DoubleSummary of​(long count, double min, double max, double sum, double mean)
      Create an immutable object which contains statistical summary values.
      static DoubleSummary of​(DoubleSummaryStatistics statistics)
      Return a new value object of the statistical summary, currently represented by the statistics object.
      double sum()
      Return the sum of values recorded, or zero if no values have been recorded.
      static double sum​(double[] values)
      Return the sum of the given double array.
      static <T> Collector<T,​?,​DoubleSummary> toDoubleSummary​(ToDoubleFunction<? super T> mapper)
      Return a Collector which applies an double-producing mapping function to each input element, and returns summary-statistics for the resulting values.
      String toString()  
    • Method Detail

      • count

        public long count()
        Returns the count of values recorded.
        Returns:
        the count of recorded values
      • min

        public double min()
        Return the minimum value recorded, or Double.POSITIVE_INFINITY if no values have been recorded.
        Returns:
        the minimum value, or Double.POSITIVE_INFINITY if none
      • max

        public double max()
        Return the maximum value recorded, or Double.NEGATIVE_INFINITY if no values have been recorded.
        Returns:
        the maximum value, or Double.NEGATIVE_INFINITY if none
      • sum

        public double sum()
        Return the sum of values recorded, or zero if no values have been recorded.
        Returns:
        the sum of values, or zero if none
      • mean

        public double mean()
        Return the arithmetic mean of values recorded, or zero if no values have been recorded.
        Returns:
        the arithmetic mean of values, or zero if none
      • of

        public static DoubleSummary of​(long count,
                                       double min,
                                       double max,
                                       double sum,
                                       double mean)
        Create an immutable object which contains statistical summary values.
        Parameters:
        count - the count of values recorded
        min - the minimum value
        max - the maximum value
        sum - the sum of the recorded values
        mean - the arithmetic mean of values
        Returns:
        an immutable object which contains statistical summary values
      • of

        public static DoubleSummary of​(DoubleSummaryStatistics statistics)
        Return a new value object of the statistical summary, currently represented by the statistics object.
        Parameters:
        statistics - the creating (mutable) statistics class
        Returns:
        the statistical moments
      • toDoubleSummary

        public static <T> Collector<T,​?,​DoubleSummarytoDoubleSummary​(ToDoubleFunction<? super T> mapper)
        Return a Collector which applies an double-producing mapping function to each input element, and returns summary-statistics for the resulting values.
        final Stream<SomeObject> stream = ... final DoubleSummary summary = stream .collect(toDoubleSummary(v -> v.doubleValue()));
        Type Parameters:
        T - the type of the input elements
        Parameters:
        mapper - a mapping function to apply to each element
        Returns:
        a Collector implementing the summary-statistics reduction
        Throws:
        NullPointerException - if the given mapper is null
      • min

        public static double min​(double[] values)
        Return the minimum value of the given double array.
        Parameters:
        values - the double array.
        Returns:
        the minimum value or Double.NaN if the given array is empty.
        Throws:
        NullPointerException - if the given array is null.
        Since:
        4.0
      • max

        public static double max​(double[] values)
        Return the maximum value of the given double array.
        Parameters:
        values - the double array.
        Returns:
        the maximum value or Double.NaN if the given array is empty.
        Throws:
        NullPointerException - if the given array is null.
        Since:
        4.0
      • sum

        public static double sum​(double[] values)
        Return the sum of the given double array.
        Parameters:
        values - the values to sum up.
        Returns:
        the sum of the given values.
        Throws:
        NullPointerException - if the given array is null.
        Since:
        4.0
      • mean

        public static double mean​(double[] values)
        Returns a double describing the arithmetic mean of the values, or Double.NaN if the values array is empty.
        Parameters:
        values - the values to calculate the mean of
        Returns:
        the arithmetic mean of the given values or Double.NaN if the values array is empty
        Throws:
        NullPointerException - if the given array is null.
        Since:
        4.0