Class LongStatistics.Builder

java.lang.Object
org.apache.commons.statistics.descriptive.LongStatistics.Builder
Enclosing class:
LongStatistics

public static final class LongStatistics.Builder extends Object
A builder for LongStatistics.
  • Field Details

  • Constructor Details

    • Builder

      Builder()
      Create an instance.
  • Method Details

    • add

      Add the statistic to the statistics to compute.
      Parameters:
      statistic - Statistic to compute.
      Returns:
      this instance
    • createMoment

      private void createMoment(int order)
      Creates the moment constructor for the specified order, e.g. order=3 is sum of cubed deviations.
      Parameters:
      order - Order.
    • setConfiguration

      public LongStatistics.Builder setConfiguration(StatisticsConfiguration v)
      Sets the statistics configuration options for computation of statistics.
      Parameters:
      v - Value.
      Returns:
      the builder
      Throws:
      NullPointerException - if the value is null
    • build

      public LongStatistics build()
      Builds a LongStatistics instance.
      Returns:
      LongStatistics instance.
    • build

      public LongStatistics build(long... values)
      Builds a LongStatistics instance using the input values.

      Note: LongStatistics computed using accept may be different from this instance.

      Parameters:
      values - Values.
      Returns:
      LongStatistics instance.
    • create

      private static <T> T create(Function<long[],T> constructor, long[] values)
      Creates the object from the values.
      Type Parameters:
      T - object type
      Parameters:
      constructor - Constructor.
      values - Values
      Returns:
      the instance