Mathematical Operations

Functions performing calculations over the stream.

Major themes are:

  • Moving and running product, sum, and simple average
  • Running population and sample standard deviation
  • Variations for working with Stream<BigDecimal> or mapping input elements to BigDecimal

Gatherers

FunctionDescription
exponentialMovingAverageWithAlpha()Create an exponential average of BigDecimal values, with the given alpha.
exponentialMovingAverageWithAlphaBy()Calculate the exponential moving average of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction with the given alpha.
exponentialMovingAverageWithPeriod()Create an exponential average of BigDecimal values, over the given number of periods.
exponentialMovingAverageWithPeriodBy()Calculate the exponential moving average of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction over the given number of periods.
movingMax()Create a Stream that represents the moving maximum of a Stream<T> looking back windowSize elements.
movingMaxBy()Create a Stream that represents the moving maximum of a Stream<T> looking back windowSize elements, as calculated by the given Comparator.
movingMedian()Create a Stream that represents the moving median of a Stream<BigDecimal> looking back windowSize elements.
movingMedianBy()Create a Stream that represents the moving median of BigDecimal objects mapped from a Stream<INPUT> via a function and looking back windowSize elements.
movingMin()Create a Stream that represents the moving minimum of a Stream<T> looking back windowSize elements.
movingMinBy()Create a Stream that represents the moving minimum of a Stream<T> looking back windowSize elements, as calculated by the given Comparator.
movingProduct()Calculate the moving product of a Stream<BigDecimal> looking back windowSize elements.
movingProductBy()Calculate the moving product of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction and looking back windowSize elements.
movingSum()Calculate the moving sum of a Stream<BigDecimal> looking back windowSize elements.
movingSumBy()Calculate the moving sum of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction and looking back windowSize elements.
runningMax()Calculate the running maximum value of a Stream<Comparable<T>>.
runningMaxBy()Calculate the running maximum value of a Stream<T>, as calculated by the given Comparator.
runningMedian()Calculate the running median of a Stream<BigDecimal>.
runningMedianBy()Calculate the running median of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction.
runningMin()Calculate the running minimum value of a Stream<Comparable<T>>.
runningMinBy()Calculate the running minimum value of a Stream<T>, as calculated by the given Comparator.
runningPopulationStandardDeviation()Calculate the running population standard deviation of a Stream<BigDecimal>.
runningPopulationStandardDeviationBy()Calculate the running population standard deviation of a BigDecimal objects mapped from a Stream<BigDecimal> via a mappingFunction.
runningProduct()Calculate the running product of a Stream<BigDecimal>.
runningProductBy()Calculate the running product of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction.
runningSampleStandardDeviation()Calculate the running sample standard deviation of a Stream<BigDecimal>.
runningSampleStandardDeviationBy()Calculate the running sample standard deviation of a BigDecimal objects mapped from a Stream<BigDecimal> via a mappingFunction.
runningSum()Calculate the running sum of a Stream<BigDecimal>.
runningSumBy()Calculate the running sum of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction.
simpleMovingAverage()Calculate the simple moving average of BigDecimal values over the previous windowSize number of values.
simpleMovingAverageBy()Calculate the simple moving average of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction and looking back windowSize elements.
simpleRunningAverage()Calculate the simple running average of a Stream<BigDecimal>.
simpleRunningAverageBy()Calculate the simple running average of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction.