Class IntMoments

    • 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 kurtosis()
      Return the kurtosis of values recorded, or Double.NaN if less than four values have been recorded.
      int max()
      Return the maximum value recorded, or Integer.MIN_VALUE if no values have been recorded.
      double mean()
      Return the arithmetic mean of values recorded, or zero if no values have been recorded.
      int min()
      Return the minimum value recorded, or Integer.MAX_VALUE if no values have been recorded.
      static IntMoments of​(long count, int min, int max, long sum, double mean, double variance, double skewness, double kurtosis)
      Create an immutable object which contains statistical values.
      static IntMoments of​(IntMomentStatistics statistics)
      Return a new value object of the statistical moments, currently represented by the statistics object.
      double skewness()
      Return the skewness of values recorded, or Double.NaN if less than two values have been recorded.
      long sum()
      Return the sum of values recorded, or zero if no values have been recorded.
      static <N extends Number>
      Collector<N,​?,​IntMoments>
      toIntMoments()
      Return a Collector which returns moments-statistics for the resulting values.
      static <T> Collector<T,​?,​IntMoments> toIntMoments​(ToIntFunction<? super T> mapper)
      Return a Collector which applies an int-producing mapping function to each input element, and returns moments-statistics for the resulting values.
      String toString()  
      double variance()
      Return the variance of values recorded, or Double.NaN if no values have been recorded.
    • Method Detail

      • count

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

        public int min()
        Return the minimum value recorded, or Integer.MAX_VALUE if no values have been recorded.
        Returns:
        the minimum value, or Integer.MAX_VALUE if none
      • max

        public int max()
        Return the maximum value recorded, or Integer.MIN_VALUE if no values have been recorded.
        Returns:
        the maximum value, or Integer.MIN_VALUE if none
      • sum

        public long 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
      • variance

        public double variance()
        Return the variance of values recorded, or Double.NaN if no values have been recorded.
        Returns:
        the variance of values, or NaN if none
      • skewness

        public double skewness()
        Return the skewness of values recorded, or Double.NaN if less than two values have been recorded.
        Returns:
        the skewness of values, or NaN if less than two values have been recorded
        See Also:
        Skewness
      • kurtosis

        public double kurtosis()
        Return the kurtosis of values recorded, or Double.NaN if less than four values have been recorded.
        Returns:
        the kurtosis of values, or NaN if less than four values have been recorded
        See Also:
        Kurtosis
      • of

        public static IntMoments of​(long count,
                                    int min,
                                    int max,
                                    long sum,
                                    double mean,
                                    double variance,
                                    double skewness,
                                    double kurtosis)
        Create an immutable object which contains statistical 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
        variance - the variance of values
        skewness - the skewness of values
        kurtosis - the kurtosis of values
        Returns:
        an immutable object which contains statistical values
      • of

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

        public static <N extends NumberCollector<N,​?,​IntMomentstoIntMoments()
        Return a Collector which returns moments-statistics for the resulting values.
        final Stream<Integer> stream = ... final IntMoments moments = stream.collect(toIntMoments()));
        Type Parameters:
        N - the type of the input elements
        Returns:
        a Collector implementing the moments-statistics reduction
        Since:
        4.1
      • toIntMoments

        public static <T> Collector<T,​?,​IntMomentstoIntMoments​(ToIntFunction<? super T> mapper)
        Return a Collector which applies an int-producing mapping function to each input element, and returns moments-statistics for the resulting values.
        final Stream<SomeObject> stream = ... final IntMoments moments = stream .collect(toIntMoments(v -> v.intValue()));
        Type Parameters:
        T - the type of the input elements
        Parameters:
        mapper - a mapping function to apply to each element
        Returns:
        a Collector implementing the moments-statistics reduction
        Throws:
        NullPointerException - if the given mapper is null