- forEachOrdered operation on stream applies a consumer function to each item in a parallel stream, so that item ordering is not affected by parallel processing.
one to three parallel stream
IntStream oneToThreeParallel = IntStream.of(1, 2, 3).parallel();
integer consumer
IntConsumer integerConsumer = i -> log.info(""+i);
USAGE
log.info("applying forEachOrdered operation to oneToThree parallel stream");
oneToThreeParallel.forEachOrdered(integerConsumer);
Comments
Post a comment