public final class StreamUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T,R> void |
forEvery(int count,
Stream<T> stream,
Collector<? super T,?,R> collector,
Consumer<? super R> action)
Reduces elements of a stream in partitions of a specific size, then runs an action for each reduction result.
|
public static <T,R> void forEvery(int count,
Stream<T> stream,
Collector<? super T,?,R> collector,
Consumer<? super R> action)
Note: this method does not support concurrent streams.
T - The type of stream elements.R - The type of result of reducing each partition.count - The number of elements in each partition.stream - The Stream to reduce elements for.collector - The Collector to use for reducing partitions.action - The action to run for each reduction result.Copyright © 2021–2022. All rights reserved.