|
13 | 13 | import static com.pivovarit.collectors.ParallelCollectors.Batching.parallel;
|
14 | 14 | import static com.pivovarit.collectors.test.Factory.GenericCollector.advancedCollector;
|
15 | 15 | import static com.pivovarit.collectors.test.Factory.GenericCollector.collector;
|
| 16 | +import static com.pivovarit.collectors.test.Factory.GenericCollector.limitedCollector; |
16 | 17 | import static java.util.stream.Collectors.collectingAndThen;
|
17 | 18 | import static java.util.stream.Collectors.toList;
|
18 | 19 |
|
@@ -65,6 +66,22 @@ static Stream<Factory.GenericCollector<Factory.CollectorFactory<Integer, Integer
|
65 | 66 | );
|
66 | 67 | }
|
67 | 68 |
|
| 69 | + static Stream<Factory.GenericCollector<Factory.CollectorFactoryWithParallelism<Integer, Integer>>> allBounded() { |
| 70 | + return Stream.of( |
| 71 | + limitedCollector("parallel(p)", (f, p) -> collectingAndThen(ParallelCollectors.parallel(f, p), c -> c.join().toList())), |
| 72 | + limitedCollector("parallel(e, p)", (f, p) -> collectingAndThen(ParallelCollectors.parallel(f, e(), p), c -> c.join().toList())), |
| 73 | + limitedCollector("parallel(toList(), p)", (f, p) -> collectingAndThen(ParallelCollectors.parallel(f, toList(), p), CompletableFuture::join)), |
| 74 | + limitedCollector("parallel(toList(), e, p)", (f, p) -> collectingAndThen(ParallelCollectors.parallel(f, toList(), e(), p), CompletableFuture::join)), |
| 75 | + limitedCollector("parallel(toList(), e, p) [batching]", (f, p) -> collectingAndThen(ParallelCollectors.Batching.parallel(f, toList(), e(), p), CompletableFuture::join)), |
| 76 | + limitedCollector("parallelToStream(p)", (f, p) -> collectingAndThen(ParallelCollectors.parallelToStream(f, p), Stream::toList)), |
| 77 | + limitedCollector("parallelToStream(e, p)", (f, p) -> collectingAndThen(ParallelCollectors.parallelToStream(f, e(), p), Stream::toList)), |
| 78 | + limitedCollector("parallelToStream(e, p) [batching]", (f, p) -> collectingAndThen(ParallelCollectors.Batching.parallelToStream(f, e(), p), Stream::toList)), |
| 79 | + limitedCollector("parallelToOrderedStream(p)", (f, p) -> collectingAndThen(ParallelCollectors.parallelToOrderedStream(f, p), Stream::toList)), |
| 80 | + limitedCollector("parallelToOrderedStream(e, p)", (f, p) -> collectingAndThen(ParallelCollectors.parallelToOrderedStream(f, e(), p), Stream::toList)), |
| 81 | + limitedCollector("parallelToOrderedStream(e, p) [batching]", (f, p) -> collectingAndThen(ParallelCollectors.Batching.parallelToOrderedStream(f, e(), p), Stream::toList)) |
| 82 | + ); |
| 83 | + } |
| 84 | + |
68 | 85 | public static Stream<GenericCollector<CollectorFactoryWithParallelismAndExecutor<Integer, Integer>>> boundedCollectors() {
|
69 | 86 | return Stream.of(
|
70 | 87 | advancedCollector("parallel()", (f, e, p) -> ParallelCollectors.parallel(f, e, p)),
|
|
0 commit comments