Package org.jobrunr.utils.streams
Class StreamUtils
java.lang.Object
org.jobrunr.utils.streams.StreamUtils
-
Method Summary
Modifier and TypeMethodDescriptionbatchCollector
(int batchSize, Consumer<List<T>> batchProcessor) Creates a new batch collectorstatic <X,
Y> Stream<Y> ofType
(Collection<X> items, Class<Y> clazz) static <X,
Y> Stream<Y> static <T> Collector<T,
?, T> single()
-
Method Details
-
batchCollector
public static <T> Collector<T,List<T>, batchCollectorList<T>> (int batchSize, Consumer<List<T>> batchProcessor) Creates a new batch collector- Type Parameters:
T
- the type of elements being processed- Parameters:
batchSize
- the batch size after which the batchProcessor should be calledbatchProcessor
- the batch processor which accepts batches of records to process- Returns:
- a batch collector instance
-
ofType
-
ofType
-
single
-