Gatherers

The gatherers in this library are categorized into five groups to make things easier to find and understand.

Sequence Operations which reorder, combine, or manipulate the sequence of elements.

Filtering and Selection which select or remove elements based on some criteria.

Grouping and Windowing which collect elements into groups or windows.

Mathematical Operations which perform calculations over the stream.

Validation and Constraints which enforce conditions on the stream.

Full List of Gatherers

TitleDescription
crossWith()Cross every element of the input stream with every element of the given source, emitting them to the output stream as a Pair<INPUT, CROSS>.
debounce()Limit the number of elements in the stream to some number per period, dropping anything over the limit during the period.
dedupeConsecutive()Remove consecutive duplicate elements from a stream where equality is measured by Object::equals().
dedupeConsecutiveBy()Remove consecutive duplicates, where equality is measured by a given function.
distinctBy()Filter a stream such that it only contains distinct elements as measured by the given mappingFunction.
dropEveryNth()Drop every nth element of the stream.
dropLast()Keep all elements except the last count elements of the stream.
ensureOrdered()Ensure that the Comparable elements in the input stream are in the order specified, and fail exceptionally if they are not.
ensureOrderedBy()Ensure that the elements in the input stream are in the order specified, as measured by the given Comparator, and fail exceptionally if they are not.
ensureSize()Ensure the input stream is the proper length as specified by size.
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.
filterIndexed()Filter a stream according to a given predicate, which takes both the item being examined and its index.
filterInstanceOf()Filter the elements in the stream to only include elements of the given types.
filterNotNull()Remove null elements from a stream, narrowing the output type to non-null.
filterOrdered()Filter the input stream so that it contains Comparable<INPUT> elements in the order provided.
filterOrderedBy()Filter the input stream so that it contains elements the order specified as measured by the given Comparator.
foldIndexed()Perform a fold over every element in the input stream along with its index.
group()Turn a Stream<INPUT> into a Stream<List<INPUT>> where adjacent equal elements are in the same List and equality is measured by Object::equals().
groupBy()Turn a Stream<INPUT> into a Stream<List<INPUT>> where adjacent equal elements are in the same List and equality is measured by the given mappingFunction.
groupOrdered()Convert the input stream of Comparable objects into lists of ordered objects.
groupOrderedBy()Convert the input stream of objects into lists of ordered objects, as measured by the given Comparator.
interleaveWith()Create a stream of alternating objects from the input stream and the argument source.
intersperse()Put the given element between each pair of adjacent elements in the input stream.
mapIndexed()Perform a mapping operation given the element being mapped and its zero-based index.
movingGeometricMean()Calculate the moving geometric mean of a Stream<BigDecimal> looking back windowSize elements.
movingGeometricMeanBy()Calculate the moving geometric mean of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction.
movingHarmonicMean()Calculate the moving harmonic mean of a Stream<BigDecimal> looking back windowSize elements.
movingHarmonicMeanBy()Calculate the moving harmonic mean of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction.
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.
movingMean()Calculate the moving mean of BigDecimal values over the previous windowSize number of values.
movingMeanBy()Calculate the moving mean of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction and looking back windowSize elements.
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.
movingPercentile()Create a Stream that represents the moving percentile of a Stream<BigDecimal> looking back windowSize elements.
movingPercentileBy()Create a Stream that represents the moving percentile of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction, looking back windowSize elements.
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.
movingRootMeanSquare()Calculate the moving root mean square (quadratic mean) of a Stream<BigDecimal> looking back windowSize elements.
movingRootMeanSquareBy()Calculate the moving root mean square (quadratic mean) of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction.
movingStandardDeviation()Calculate the moving standard deviation of a Stream<BigDecimal> looking back windowSize elements, as either a population or a sample.
movingStandardDeviationBy()Calculate the moving standard deviation of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction and looking back windowSize elements, as either a population or a sample.
movingStatistics()Calculate summary statistics (count, sum, mean, min, max, variance, and standard deviation) of a Stream<BigDecimal> looking back windowSize elements.
movingStatisticsBy()Calculate summary statistics (count, sum, mean, min, max, variance, and standard deviation) of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction, 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.
movingVariance()Calculate the moving variance of a Stream<BigDecimal> looking back windowSize elements, as either a population or a sample.
movingVarianceBy()Calculate the moving variance of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction and looking back windowSize elements, as either a population or a sample.
movingWeightedMean()Calculate the weighted moving mean of BigDecimal values over the previous windowSize number of values, giving newer values more weight.
movingWeightedMeanBy()Calculate the weighted moving mean of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction and looking back windowSize elements, giving newer values more weight.
orderByFrequency()Emit elements in the input stream ordered by the specified frequency.
peekIndexed()Peek at each element of the stream along with its zero-based index.
repeat()Repeatedly emit the input stream to the output stream a given number of times.
repeatInfinitely()Repeatedly emit the input stream to the output stream, infinitely.
reverse()Reverse the order of the input stream.
rotate()Consume the entire stream and emit its elements rotated either left or right distance number of spaces.
runningGeometricMean()Calculate the running geometric mean of a Stream<BigDecimal>.
runningGeometricMeanBy()Calculate the running geometric mean of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction.
runningHarmonicMean()Calculate the running harmonic mean of a Stream<BigDecimal>.
runningHarmonicMeanBy()Calculate the running harmonic mean of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction.
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.
runningMean()Calculate the running mean of a Stream<BigDecimal>.
runningMeanBy()Calculate the running mean of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction.
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.
runningPercentile()Calculate the running percentile of a Stream<BigDecimal>.
runningPercentileBy()Calculate the running percentile of BigDecimal objects mapped from a Stream<INPUT> 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.
runningRootMeanSquare()Calculate the running root mean square (quadratic mean) of a Stream<BigDecimal>.
runningRootMeanSquareBy()Calculate the running root mean square (quadratic mean) of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction.
runningStandardDeviation()Calculate the running standard deviation of a Stream<BigDecimal>, as either a population or a sample.
runningStandardDeviationBy()Calculate the running standard deviation of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction, as either a population or a sample.
runningStatistics()Calculate summary statistics (count, sum, mean, min, max, variance, and standard deviation) of a Stream<BigDecimal> so far.
runningStatisticsBy()Calculate summary statistics (count, sum, mean, min, max, variance, and standard deviation) of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction so far.
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.
runningVariance()Calculate the running variance of a Stream<BigDecimal>, as either a population or a sample.
runningVarianceBy()Calculate the running variance of BigDecimal objects mapped from a Stream<INPUT> via a mappingFunction, as either a population or a sample.
sampleFixedSize()Perform a fixed-size sampling over the input stream.
samplePercentage()Perform a percentage-based sampling over the input stream.
scanIndexed()Perform a scan over every element in the input stream along with its index.
shuffle()Shuffle the input stream into a random order.
takeEveryNth()Take every nth element of the stream.
takeLast()Remove all but the last count elements from the stream.
takeUntil()Take elements from the input stream until the predicate is met, including the first element that matches the predicate.
throttle()Limit the number of elements in the stream to some number per period. When the limit is reached, consumption is paused until a new period starts and the count resets.
uniquelyOccurring()Emit only those elements that occur in the input stream a single time.
uniquelyOccurringBy()Emit only those elements that occur in the input stream a single time, as measured by the given function.
window()Create windows over the elements of the input stream that are windowSize in length, sliding over stepping elements and optionally including partial windows at the end of the stream.
withIndex()Maps all elements of the stream as-is along with their 0-based index.
zipWith()Creates a stream of Pair<FIRST,SECOND> objects whose values come from the input stream and the source of arguments provided.
zipWithNext()Creates a stream of List objects which contain each two adjacent elements in the input stream.