ParallelCollectors.java

1
/*
2
 * Copyright 2014-2026 Grzegorz Piwowarek, https://4comprehension.com/
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 * https://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package com.pivovarit.collectors;
17
18
import java.util.List;
19
import java.util.Objects;
20
import java.util.concurrent.CompletableFuture;
21
import java.util.concurrent.Executor;
22
import java.util.function.Function;
23
import java.util.stream.Collector;
24
import java.util.stream.Stream;
25
import org.jspecify.annotations.NullMarked;
26
27
/**
28
 * An umbrella class exposing static factory methods for instantiating parallel {@link Collector}s
29
 *
30
 * @author Grzegorz Piwowarek
31
 */
32
@NullMarked
33
public final class ParallelCollectors {
34
35
    private ParallelCollectors() {
36
    }
37
38
    /**
39
     * A convenience {@link Collector} that performs parallel computations using Virtual Threads
40
     * and returns a {@link CompletableFuture} containing the result of applying the user-provided
41
     * {@link Collector} to the mapped elements.
42
     * <p>
43
     * Each element is transformed using the provided {@code mapper} in parallel on Virtual Threads,
44
     * and the results are reduced according to the supplied {@code collector}.
45
     *
46
     * <br>
47
     * Example:
48
     * <pre>{@code
49
     * CompletableFuture<List<String>> result = Stream.of(1, 2, 3)
50
     *   .collect(parallel(i -> foo(i), toList()));
51
     * }</pre>
52
     *
53
     * @param mapper    transformation applied to each element
54
     * @param collector the {@code Collector} describing the reduction
55
     * @param <T>       the input element type
56
     * @param <R>       the type produced by {@code mapper}
57
     * @param <RR>      the reduction result type produced by {@code collector}
58
     *
59
     * @return a {@code Collector} producing a {@link CompletableFuture} of the reduced result
60
     *
61
     * @since 3.0.0
62
     */
63
    public static <T, R, RR> Collector<T, ?, CompletableFuture<RR>> parallel(
64
      Function<? super T, ? extends R> mapper,
65
      Collector<R, ?, RR> collector) {
66
67
        Objects.requireNonNull(collector, "collector cannot be null");
68 2 1. parallel : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallel → KILLED
2. lambda$parallel$0 : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::lambda$parallel$0 → KILLED
        return Factory.collecting(s -> s.collect(collector), mapper, Configurer.collecting(c -> {}));
69
    }
70
71
    /**
72
     * A convenience {@link Collector} that performs parallel computations by classifying input
73
     * elements using the provided {@code classifier}, applying the given {@code mapper}, and
74
     * emitting {@link Grouped} entries representing each batch.
75
     * <p>
76
     * The generated {@link Stream} of {@code Grouped<K, R>} instances is then reduced using the
77
     * user-provided {@code collector}, executed on Virtual Threads. Each group is processed
78
     * independently, and every batch is guaranteed to be processed on a single thread.
79
     * The reduction is applied to the grouped results rather than to the raw mapped elements.
80
     * <br>
81
     * <br>
82
     * Example:
83
     * <pre>{@code
84
     * CompletableFuture<List<Grouped<String, String>>> result = Stream.of(t1, t2, t3)
85
     *   .collect(parallelBy(Task::groupId, t -> compute(t), toList()));
86
     * }</pre>
87
     *
88
     * @param classifier function that groups elements into batches
89
     * @param mapper     transformation applied to each element
90
     * @param collector  the {@code Collector} describing the reduction for each batch
91
     * @param <T>        the input element type
92
     * @param <K>        the classification key type
93
     * @param <R>        the type produced by {@code mapper}
94
     * @param <RR>       the reduction result type produced by {@code collector}
95
     *
96
     * @return a {@code Collector} producing a {@link CompletableFuture} whose value is obtained
97
     * by reducing the {@code Stream<Grouped<K, R>>} produced by the parallel classification
98
     *
99
     * @since 3.4.0
100
     */
101
    public static <T, K, R, RR> Collector<T, ?, CompletableFuture<RR>> parallelBy(
102
      Function<? super T, ? extends K> classifier,
103
      Function<? super T, ? extends R> mapper,
104
      Collector<Grouped<K, R>, ?, RR> collector) {
105
106
        Objects.requireNonNull(collector, "collector cannot be null");
107
108 2 1. parallelBy : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelBy → KILLED
2. lambda$parallelBy$0 : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::lambda$parallelBy$0 → KILLED
        return Factory.collectingBy(classifier, (Function<Stream<Grouped<K, R>>, RR>) s -> s.collect(collector), mapper, Configurer.collecting(c -> {}));
109
    }
110
111
    /**
112
     * A convenience {@link Collector} that performs parallel computations using Virtual Threads
113
     * and returns a {@link CompletableFuture} containing the result of applying the user-provided
114
     * {@link Collector} to the mapped elements, with a configurable parallelism level.
115
     * <p>
116
     * Each element is transformed using the provided {@code mapper} in parallel on Virtual Threads,
117
     * and the results are reduced according to the supplied {@code collector}.
118
     *
119
     * <br>
120
     * Example:
121
     * <pre>{@code
122
     * CompletableFuture<List<String>> result = Stream.of(1, 2, 3)
123
     *   .collect(parallel(i -> foo(i), toList(), 2));
124
     * }</pre>
125
     *
126
     * @param mapper      transformation applied to each element
127
     * @param collector   the {@code Collector} describing the reduction
128
     * @param parallelism the maximum degree of parallelism
129
     * @param <T>         the input element type
130
     * @param <R>         the type produced by {@code mapper}
131
     * @param <RR>        the reduction result type produced by {@code collector}
132
     *
133
     * @return a {@code Collector} producing a {@link CompletableFuture} of the reduced result
134
     *
135
     * @since 3.2.0
136
     */
137
    public static <T, R, RR> Collector<T, ?, CompletableFuture<RR>> parallel(
138
      Function<? super T, ? extends R> mapper,
139
      Collector<R, ?, RR> collector,
140
      int parallelism) {
141
142
        Objects.requireNonNull(collector, "collector cannot be null");
143 2 1. lambda$parallel$2 : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::lambda$parallel$2 → KILLED
2. parallel : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallel → KILLED
        return Factory.collecting(s -> s.collect(collector), mapper, Configurer.collecting(c -> c.parallelism(parallelism)));
144
    }
145
146
    /**
147
     * A convenience {@link Collector} that performs parallel computations by classifying input
148
     * elements using the provided {@code classifier}, applying the given {@code mapper}, and
149
     * emitting {@link Grouped} entries representing each batch.
150
     * <p>
151
     * The generated {@link Stream} of {@code Grouped<K, R>} instances is then reduced using the
152
     * user-provided {@code collector}, executed on Virtual Threads. Each group is processed
153
     * independently, and every batch is guaranteed to be processed on a single thread.
154
     * The reduction is applied to the grouped results rather than to the raw mapped elements.
155
     * A configurable {@code parallelism} parameter defines the maximum
156
     * level of concurrent processing.
157
     * <br>
158
     * <br>
159
     * Example:
160
     * <pre>{@code
161
     * CompletableFuture<List<Grouped<String, String>>> result = Stream.of(t1, t2, t3)
162
     *   .collect(parallelBy(Task::groupId, t -> compute(t), toList(), 4));
163
     * }</pre>
164
     *
165
     * @param classifier  function that groups elements into batches
166
     * @param mapper      transformation applied to each element
167
     * @param collector   reduction applied to the resulting {@code Stream<Grouped<K, R>>}
168
     * @param parallelism maximum allowed parallelism
169
     * @param <T>         the input element type
170
     * @param <K>         the classification key type
171
     * @param <R>         the type produced by {@code mapper}
172
     * @param <RR>        the reduction result type produced by {@code collector}
173
     *
174
     * @return a {@code Collector} producing a {@link CompletableFuture} whose value is obtained
175
     * by reducing the {@code Stream<Grouped<K, R>>} produced by the parallel classification
176
     *
177
     * @since 3.4.0
178
     */
179
    public static <T, K, R, RR> Collector<T, ?, CompletableFuture<RR>> parallelBy(
180
      Function<? super T, ? extends K> classifier,
181
      Function<? super T, ? extends R> mapper,
182
      Collector<Grouped<K, R>, ?, RR> collector,
183
      int parallelism) {
184
185
        Objects.requireNonNull(collector, "collector cannot be null");
186
187 2 1. lambda$parallelBy$2 : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::lambda$parallelBy$2 → KILLED
2. parallelBy : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelBy → KILLED
        return Factory.collectingBy(classifier, (Function<Stream<Grouped<K, R>>, RR>) s -> s.collect(collector), mapper, Configurer.collecting(c -> c.parallelism(parallelism)));
188
    }
189
190
    /**
191
     * A convenience {@link Collector} that performs parallel computations on a custom {@link Executor}
192
     * and returns a {@link CompletableFuture} containing the result of applying the user-provided
193
     * {@link Collector} to the mapped elements, with a configurable parallelism level.
194
     * <p>
195
     * Each element is transformed using the provided {@code mapper} in parallel on the specified
196
     * {@code executor}, and the results are reduced according to the supplied {@code collector}.
197
     *
198
     * <br>
199
     * Example:
200
     * <pre>{@code
201
     * CompletableFuture<List<String>> result = Stream.of(1, 2, 3)
202
     *   .collect(parallel(i -> foo(i), toList(), executor, 2));
203
     * }</pre>
204
     *
205
     * @param mapper      transformation applied to each element
206
     * @param collector   the {@code Collector} describing the reduction
207
     * @param executor    the {@code Executor} used for asynchronous execution
208
     * @param parallelism the maximum degree of parallelism
209
     * @param <T>         the input element type
210
     * @param <R>         the type produced by {@code mapper}
211
     * @param <RR>        the reduction result type produced by {@code collector}
212
     *
213
     * @return a {@code Collector} producing a {@link CompletableFuture} of the reduced result
214
     *
215
     * @since 2.0.0
216
     */
217
    public static <T, R, RR> Collector<T, ?, CompletableFuture<RR>> parallel(
218
      Function<? super T, ? extends R> mapper,
219
      Collector<R, ?, RR> collector,
220
      Executor executor,
221
      int parallelism) {
222
223
        Objects.requireNonNull(collector, "collector cannot be null");
224 2 1. lambda$parallel$4 : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::lambda$parallel$4 → KILLED
2. parallel : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallel → KILLED
        return Factory.collecting(s -> s.collect(collector), mapper, Configurer.collecting(c -> c.executor(executor)
225
          .parallelism(parallelism)));
226
    }
227
228
    /**
229
     * A convenience {@link Collector} that performs parallel computations by classifying input
230
     * elements using the provided {@code classifier}, applying the given {@code mapper}, and
231
     * emitting {@link Grouped} entries representing each batch.
232
     * <p>
233
     * The generated {@link Stream} of {@code Grouped<K, R>} instances is then reduced using the
234
     * user-provided {@code collector}, executed on the supplied {@link Executor}. Each group is
235
     * processed independently, and every batch is guaranteed to be processed on a single thread.
236
     * The reduction is applied to grouped results rather than to the raw mapped elements. A
237
     * configurable {@code parallelism} parameter defines the maximum level of concurrent batch
238
     * execution.
239
     * <br>
240
     * <br>
241
     * Example:
242
     * <pre>{@code
243
     * CompletableFuture<List<Grouped<String, String>>> result = Stream.of(t1, t2, t3)
244
     *   .collect(parallelBy(Task::groupId, t -> compute(t), toList(), executor, 4));
245
     * }</pre>
246
     *
247
     * @param classifier  function that groups elements into batches
248
     * @param mapper      transformation applied to each element
249
     * @param collector   reduction applied to the resulting {@code Stream<Grouped<K, R>>}
250
     * @param executor    the {@code Executor} used for asynchronous execution
251
     * @param parallelism maximum allowed parallelism
252
     * @param <T>         the input element type
253
     * @param <K>         the classification key type
254
     * @param <R>         the type produced by {@code mapper}
255
     * @param <RR>        the reduction result type produced by {@code collector}
256
     *
257
     * @return a {@code Collector} producing a {@link CompletableFuture} whose value is obtained
258
     * by reducing the {@code Stream<Grouped<K, R>>} produced by the parallel classification
259
     *
260
     * @since 3.4.0
261
     */
262
    public static <T, K, R, RR> Collector<T, ?, CompletableFuture<RR>> parallelBy(
263
      Function<? super T, ? extends K> classifier,
264
      Function<? super T, ? extends R> mapper,
265
      Collector<Grouped<K, R>, ?, RR> collector,
266
      Executor executor,
267
      int parallelism) {
268
269
        Objects.requireNonNull(collector, "collector cannot be null");
270
271 2 1. parallelBy : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelBy → KILLED
2. lambda$parallelBy$4 : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::lambda$parallelBy$4 → KILLED
        return Factory.collectingBy(classifier, (Function<Stream<Grouped<K, R>>, RR>) s -> s.collect(collector), mapper,
272
          Configurer.collecting(c -> c
273
            .executor(executor)
274
            .parallelism(parallelism)));
275
    }
276
277
    /**
278
     * A convenience {@link Collector} that performs parallel computations on a custom {@link Executor}
279
     * with effectively unlimited parallelism and returns a {@link CompletableFuture} containing the
280
     * result of applying the user-provided {@link Collector} to the mapped elements.
281
     * <p>
282
     * Each element is transformed using the provided {@code mapper} in parallel on the specified
283
     * {@code executor}, and the results are reduced according to the supplied {@code collector}.
284
     *
285
     * <br>
286
     * Example:
287
     * <pre>{@code
288
     * CompletableFuture<List<String>> result = Stream.of(1, 2, 3)
289
     *   .collect(parallel(i -> foo(i), toList(), executor));
290
     * }</pre>
291
     *
292
     * @param mapper    transformation applied to each element
293
     * @param collector the {@code Collector} describing the reduction
294
     * @param executor  the {@code Executor} used for asynchronous execution
295
     * @param <T>       the input element type
296
     * @param <R>       the type produced by {@code mapper}
297
     * @param <RR>      the reduction result type produced by {@code collector}
298
     *
299
     * @return a {@code Collector} producing a {@link CompletableFuture} of the reduced result
300
     *
301
     * @since 3.3.0
302
     */
303
    public static <T, R, RR> Collector<T, ?, CompletableFuture<RR>> parallel(
304
      Function<? super T, ? extends R> mapper,
305
      Collector<R, ?, RR> collector,
306
      Executor executor) {
307
308
        Objects.requireNonNull(collector, "collector cannot be null");
309 2 1. parallel : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallel → KILLED
2. lambda$parallel$6 : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::lambda$parallel$6 → KILLED
        return Factory.collecting(s -> s.collect(collector), mapper, Configurer.collecting(c -> c.executor(executor)));
310
    }
311
312
    /**
313
     * A convenience {@link Collector} that performs parallel computations by classifying input
314
     * elements using the provided {@code classifier}, applying the given {@code mapper}, and
315
     * emitting {@link Grouped} entries representing each batch.
316
     * <p>
317
     * The generated {@link Stream} of {@code Grouped<K, R>} instances is then reduced using the
318
     * user-provided {@code collector}, executed on the supplied {@link Executor}. Each group is
319
     * processed independently, and every batch is guaranteed to be processed on a single thread.
320
     * The reduction is applied to grouped results rather than to the raw mapped elements.
321
     * <br>
322
     * <br>
323
     * Example:
324
     * <pre>{@code
325
     * CompletableFuture<List<Grouped<String, String>>> result = Stream.of(task1, task2, task3)
326
     *   .collect(parallelBy(
327
     *       Task::groupId,
328
     *       t -> compute(t),
329
     *       toList(),
330
     *       executor));
331
     * }</pre>
332
     *
333
     * @param classifier function that groups elements into batches
334
     * @param mapper     transformation applied to each element
335
     * @param collector  reduction applied to the resulting {@code Stream<Grouped<K, R>>}
336
     * @param executor   the {@code Executor} used for asynchronous execution
337
     * @param <T>        the input element type
338
     * @param <K>        the classification key type
339
     * @param <R>        the type produced by {@code mapper}
340
     * @param <RR>       the reduction result type produced by {@code collector}
341
     *
342
     * @return a {@code Collector} producing a {@link CompletableFuture} whose value is obtained
343
     * by reducing the {@code Stream<Grouped<K, R>>} produced by the parallel classification
344
     *
345
     * @since 3.4.0
346
     */
347
    public static <T, K, R, RR> Collector<T, ?, CompletableFuture<RR>> parallelBy(
348
      Function<? super T, ? extends K> classifier,
349
      Function<? super T, ? extends R> mapper,
350
      Collector<Grouped<K, R>, ?, RR> collector,
351
      Executor executor) {
352
        Objects.requireNonNull(collector, "collector cannot be null");
353 2 1. lambda$parallelBy$6 : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::lambda$parallelBy$6 → KILLED
2. parallelBy : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelBy → KILLED
        return Factory.collectingBy(classifier, (Function<Stream<Grouped<K, R>>, RR>) s -> s.collect(collector), mapper, Configurer.collecting(c -> c.executor(executor)));
354
    }
355
356
    /**
357
     * A convenience {@link Collector} that performs parallel computations using Virtual Threads
358
     * and returns a {@link CompletableFuture} containing a {@link Stream} of the mapped elements.
359
     * <p>
360
     * The collector maintains the encounter order of the processed elements. Instances of this
361
     * collector should not be reused.
362
     *
363
     * <br>
364
     * Example:
365
     * <pre>{@code
366
     * CompletableFuture<Stream<String>> result = Stream.of(1, 2, 3)
367
     *   .collect(parallel(i -> foo()));
368
     * }</pre>
369
     *
370
     * @param mapper a transformation applied to each element
371
     * @param <T>    the input element type
372
     * @param <R>    the type produced by {@code mapper}
373
     *
374
     * @return a {@code Collector} producing a {@link CompletableFuture} of a {@link Stream} of mapped elements
375
     *
376
     * @since 3.0.0
377
     */
378
    public static <T, R> Collector<T, ?, CompletableFuture<Stream<R>>> parallel(
379
      Function<? super T, ? extends R> mapper) {
380
381 2 1. parallel : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallel → KILLED
2. lambda$parallel$8 : replaced return value with Stream.empty for com/pivovarit/collectors/ParallelCollectors::lambda$parallel$8 → KILLED
        return Factory.collecting((Function<Stream<R>, Stream<R>>) i -> i, mapper, Configurer.collecting(c -> {}));
382
    }
383
384
    /**
385
     * A convenience {@link Collector} that performs parallel computations by classifying input
386
     * elements using the provided {@code classifier}, applying the given {@code mapper}, and
387
     * emitting {@link Grouped} entries representing each batch.
388
     * <p>
389
     * The resulting {@link CompletableFuture} completes with a {@link Stream} of
390
     * {@code Grouped<K, R>} instances. Each group is processed independently on Virtual Threads,
391
     * and every batch is guaranteed to be processed on a single thread. The encounter order of
392
     * elements within each batch is preserved.
393
     * <br>
394
     * <br>
395
     * Example:
396
     * <pre>{@code
397
     * CompletableFuture<Stream<Grouped<String, String>>> result = Stream.of(t1, t2, t3)
398
     *   .collect(parallelBy(Task::groupId, t -> compute(t)));
399
     * }</pre>
400
     *
401
     * @param classifier function that groups elements into batches
402
     * @param mapper     transformation applied to each element
403
     * @param <T>        the input element type
404
     * @param <K>        the classification key type
405
     * @param <R>        the type produced by {@code mapper}
406
     *
407
     * @return a {@code Collector} producing a {@link CompletableFuture} whose value is a
408
     * {@link Stream} of {@code Grouped<K, R>} produced by the parallel classification
409
     *
410
     * @since 3.4.0
411
     */
412
    public static <T, K, R> Collector<T, ?, CompletableFuture<Stream<Grouped<K, R>>>> parallelBy(
413
      Function<? super T, ? extends K> classifier,
414
      Function<? super T, ? extends R> mapper) {
415 1 1. parallelBy : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelBy → KILLED
        return Factory.collectingBy(classifier, mapper, Configurer.collecting(c -> {}));
416
    }
417
418
    /**
419
     * A convenience {@link Collector} that performs parallel computations using Virtual Threads
420
     * and returns a {@link CompletableFuture} containing a {@link Stream} of the mapped elements.
421
     * <p>
422
     * The collector maintains the encounter order of the processed elements. Instances of this
423
     * collector should not be reused.
424
     *
425
     * <br>
426
     * Example:
427
     * <pre>{@code
428
     * CompletableFuture<Stream<String>> result = Stream.of(1, 2, 3)
429
     *   .collect(parallel(i -> foo(), 4));
430
     * }</pre>
431
     *
432
     * @param mapper      a transformation applied to each element
433
     * @param parallelism the maximum degree of parallelism
434
     * @param <T>         the input element type
435
     * @param <R>         the type produced by {@code mapper}
436
     *
437
     * @return a {@code Collector} producing a {@link CompletableFuture} of a {@link Stream} of mapped elements
438
     *
439
     * @since 3.2.0
440
     */
441
    public static <T, R> Collector<T, ?, CompletableFuture<Stream<R>>> parallel(
442
      Function<? super T, ? extends R> mapper,
443
      int parallelism) {
444 2 1. parallel : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallel → KILLED
2. lambda$parallel$10 : replaced return value with Stream.empty for com/pivovarit/collectors/ParallelCollectors::lambda$parallel$10 → KILLED
        return Factory.collecting((Function<Stream<R>, Stream<R>>) i -> i, mapper, Configurer.collecting(c -> c.parallelism(parallelism)));
445
    }
446
447
    /**
448
     * A convenience {@link Collector} that performs parallel computations by classifying input
449
     * elements using the provided {@code classifier}, applying the given {@code mapper}, and
450
     * emitting {@link Grouped} entries representing each batch.
451
     * <p>
452
     * The resulting {@link CompletableFuture} completes with a {@link Stream} of
453
     * {@code Grouped<K, R>} instances. Each group is processed independently on Virtual Threads,
454
     * and every batch is guaranteed to be processed on a single thread. The encounter order of
455
     * elements within each batch is preserved.
456
     * <br>
457
     * <br>
458
     * Example:
459
     * <pre>{@code
460
     * CompletableFuture<Stream<Grouped<String, String>>> result = Stream.of(t1, t2, t3)
461
     *   .collect(parallelBy(Task::groupId, t -> compute(t), 4));
462
     * }</pre>
463
     *
464
     * @param classifier  function that groups elements into batches
465
     * @param mapper      transformation applied to each element
466
     * @param parallelism the maximum degree of parallelism
467
     * @param <T>         the input element type
468
     * @param <K>         the classification key type
469
     * @param <R>         the type produced by {@code mapper}
470
     *
471
     * @return a {@code Collector} producing a {@link CompletableFuture} whose value is a
472
     * {@link Stream} of {@code Grouped<K, R>} produced by the parallel classification
473
     *
474
     * @since 3.4.0
475
     */
476
    public static <T, K, R> Collector<T, ?, CompletableFuture<Stream<Grouped<K, R>>>> parallelBy(
477
      Function<? super T, ? extends K> classifier,
478
      Function<? super T, ? extends R> mapper,
479
      int parallelism) {
480 1 1. parallelBy : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelBy → KILLED
        return Factory.collectingBy(classifier, mapper, Configurer.collecting(c -> c.parallelism(parallelism)));
481
    }
482
483
    /**
484
     * A convenience {@link Collector} that performs parallel computations on a custom {@link Executor}
485
     * and returns a {@link CompletableFuture} containing a {@link Stream} of the mapped elements.
486
     * <p>
487
     * The collector maintains the encounter order of the processed elements. Instances of this
488
     * collector should not be reused.
489
     *
490
     * <br>
491
     * Example:
492
     * <pre>{@code
493
     * CompletableFuture<Stream<String>> result = Stream.of(1, 2, 3)
494
     *   .collect(parallel(i -> foo(), executor, 2));
495
     * }</pre>
496
     *
497
     * @param mapper      a transformation applied to each element
498
     * @param executor    the {@code Executor} used for asynchronous execution
499
     * @param parallelism the maximum degree of parallelism
500
     * @param <T>         the input element type
501
     * @param <R>         the type produced by {@code mapper}
502
     *
503
     * @return a {@code Collector} producing a {@link CompletableFuture} of a {@link Stream} of mapped elements
504
     *
505
     * @since 2.0.0
506
     */
507
    public static <T, R> Collector<T, ?, CompletableFuture<Stream<R>>> parallel(
508
      Function<? super T, ? extends R> mapper,
509
      Executor executor,
510
      int parallelism) {
511
512 2 1. lambda$parallel$12 : replaced return value with Stream.empty for com/pivovarit/collectors/ParallelCollectors::lambda$parallel$12 → KILLED
2. parallel : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallel → KILLED
        return Factory.collecting((Function<Stream<R>, Stream<R>>) i -> i, mapper,
513
          Configurer.collecting(c -> c
514
            .executor(executor)
515
            .parallelism(parallelism)));
516
    }
517
518
    /**
519
     * A convenience {@link Collector} that performs parallel computations by classifying elements
520
     * into groups using the provided {@code classifier}, executing each group asynchronously on the
521
     * supplied {@link Executor}, and returning a {@link CompletableFuture} that yields a
522
     * {@link Stream} of {@link Grouped} results.
523
     * <p>
524
     * Elements within each group preserve encounter order. Instances of this collector are not
525
     * intended to be reused.
526
     *
527
     * <br>
528
     * Example:
529
     * <pre>{@code
530
     * CompletableFuture<Stream<Grouped<String, String>>> result = Stream.of(t1, t2, t3)
531
     *   .collect(parallelBy(Task::groupId, t -> compute(t), executor, 4));
532
     * }</pre>
533
     *
534
     * @param classifier  function that assigns each input element to a group
535
     * @param mapper      transformation applied to each element
536
     * @param executor    the {@code Executor} used for asynchronous execution
537
     * @param parallelism the maximum degree of parallelism
538
     * @param <T>         the input element type
539
     * @param <K>         the classification key type
540
     * @param <R>         the mapped element type
541
     *
542
     * @return a {@code Collector} producing a {@link CompletableFuture} of a
543
     * {@link Stream} of {@link Grouped} results
544
     *
545
     * @since 3.4.0
546
     */
547
    public static <T, K, R> Collector<T, ?, CompletableFuture<Stream<Grouped<K, R>>>> parallelBy(
548
      Function<? super T, ? extends K> classifier,
549
      Function<? super T, ? extends R> mapper,
550
      Executor executor,
551
      int parallelism) {
552 1 1. parallelBy : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelBy → KILLED
        return Factory.collectingBy(classifier, mapper,
553
          Configurer.collecting(c -> c
554
            .executor(executor)
555
            .parallelism(parallelism)));
556
    }
557
558
    /**
559
     * A convenience {@link Collector} that performs parallel computations on a custom {@link Executor}
560
     * with effectively unlimited parallelism and returns a {@link CompletableFuture} containing a
561
     * {@link Stream} of the mapped elements.
562
     * <p>
563
     * The collector maintains the encounter order of the processed elements. Instances of this
564
     * collector should not be reused.
565
     *
566
     * <br>
567
     * Example:
568
     * <pre>{@code
569
     * CompletableFuture<Stream<String>> result = Stream.of(1, 2, 3)
570
     *   .collect(parallel(i -> foo(), executor));
571
     * }</pre>
572
     *
573
     * @param mapper   a transformation applied to each element
574
     * @param executor the {@code Executor} used for asynchronous execution
575
     * @param <T>      the input element type
576
     * @param <R>      the type produced by {@code mapper}
577
     *
578
     * @return a {@code Collector} producing a {@link CompletableFuture} of a {@link Stream} of mapped elements
579
     *
580
     * @since 3.3.0
581
     */
582
    public static <T, R> Collector<T, ?, CompletableFuture<Stream<R>>> parallel(
583
      Function<? super T, ? extends R> mapper,
584
      Executor executor) {
585
586 2 1. parallel : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallel → KILLED
2. lambda$parallel$14 : replaced return value with Stream.empty for com/pivovarit/collectors/ParallelCollectors::lambda$parallel$14 → KILLED
        return Factory.collecting((Function<Stream<R>, Stream<R>>) i -> i, mapper, Configurer.collecting(c -> c.executor(executor)));
587
    }
588
589
    /**
590
     * A convenience {@link Collector} that performs parallel computations by classifying elements
591
     * using the provided {@code classifier}, executing each group asynchronously on the supplied
592
     * {@link Executor}, and returning a {@link CompletableFuture} that yields a
593
     * {@link Stream} of {@link Grouped} results.
594
     * <p>
595
     * Elements within a group preserve their encounter order. Instances of this collector are
596
     * not intended to be reused.
597
     *
598
     * <br>
599
     * Example:
600
     * <pre>{@code
601
     * CompletableFuture<Stream<Grouped<String, String>>> future = Stream.of(t1, t2, t3)
602
     *   .collect(parallelBy(Task::groupId, t -> compute(t), executor));
603
     * }</pre>
604
     *
605
     * @param classifier function that assigns each element to a group
606
     * @param mapper     transformation applied to each element
607
     * @param executor   the {@code Executor} used for asynchronous execution
608
     * @param <T>        the input element type
609
     * @param <K>        the classification key type
610
     * @param <R>        the mapped element type
611
     *
612
     * @return a {@code Collector} producing a {@link CompletableFuture}
613
     * of a {@link Stream} of {@link Grouped} results
614
     *
615
     * @since 3.4.0
616
     */
617
    public static <T, K, R> Collector<T, ?, CompletableFuture<Stream<Grouped<K, R>>>> parallelBy(
618
      Function<? super T, ? extends K> classifier,
619
      Function<? super T, ? extends R> mapper,
620
      Executor executor) {
621
622 1 1. parallelBy : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelBy → KILLED
        return Factory.collectingBy(classifier, mapper, Configurer.collecting(c -> c.executor(executor)));
623
    }
624
625
    /**
626
     * A convenience {@link Collector} that performs parallel computations using Virtual Threads
627
     * and returns a {@link Stream} of the mapped elements as they arrive.
628
     * <p>
629
     * For a parallelism of 1, the stream is executed by the calling thread.
630
     *
631
     * <br>
632
     * Example:
633
     * <pre>{@code
634
     * Stream.of(1, 2, 3)
635
     *   .collect(parallelToStream(i -> foo()))
636
     *   .forEach(System.out::println);
637
     * }</pre>
638
     *
639
     * @param mapper a transformation applied to each element
640
     * @param <T>    the input element type
641
     * @param <R>    the type produced by {@code mapper}
642
     *
643
     * @return a {@code Collector} producing a {@link Stream} of mapped elements in parallel
644
     *
645
     * @since 3.0.0
646
     */
647
    public static <T, R> Collector<T, ?, Stream<R>> parallelToStream(
648
      Function<? super T, ? extends R> mapper) {
649
650 1 1. parallelToStream : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToStream → KILLED
        return Factory.streaming(mapper, Configurer.streaming(c -> {}));
651
    }
652
653
    /**
654
     * A convenience {@link Collector} that performs parallel computations by classifying elements
655
     * using the provided {@code classifier}, applying the given {@code mapper}, and producing a
656
     * {@link Stream} of {@link Grouped} elements as they become available.
657
     * <p>
658
     * Each group is processed independently on Virtual Threads, and every batch is guaranteed to
659
     * be executed on a single thread. The encounter order within each group is preserved.
660
     *
661
     * <br>
662
     * Example:
663
     * <pre>{@code
664
     * Stream.of(task1, task2, task3)
665
     *   .collect(parallelToStreamBy(Task::groupId, t -> compute(t)))
666
     *   .forEach(System.out::println);
667
     * }</pre>
668
     *
669
     * @param classifier function that assigns each input element to a group
670
     * @param mapper     transformation applied to each element
671
     * @param <T>        the input element type
672
     * @param <K>        the classification key type
673
     * @param <R>        the mapped element type
674
     *
675
     * @return a {@code Collector} producing a {@link Stream} of {@link Grouped} elements
676
     * computed in parallel
677
     *
678
     * @since 3.4.0
679
     */
680
    public static <T, K, R> Collector<T, ?, Stream<Grouped<K, R>>> parallelToStreamBy(
681
      Function<? super T, ? extends K> classifier,
682
      Function<? super T, ? extends R> mapper) {
683
684 1 1. parallelToStreamBy : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToStreamBy → KILLED
        return Factory.streamingBy(classifier, mapper, Configurer.streaming(c -> {}));
685
    }
686
687
    /**
688
     * A convenience {@link Collector} that performs parallel computations using Virtual Threads
689
     * and returns a {@link Stream} of the mapped elements as they arrive.
690
     * <p>
691
     * For a parallelism of 1, the stream is executed by the calling thread.
692
     *
693
     * <br>
694
     * Example:
695
     * <pre>{@code
696
     * Stream.of(1, 2, 3)
697
     *   .collect(parallelToStream(i -> foo(), 2))
698
     *   .forEach(System.out::println);
699
     * }</pre>
700
     *
701
     * @param mapper      a transformation applied to each element
702
     * @param parallelism the maximum degree of parallelism
703
     * @param <T>         the input element type
704
     * @param <R>         the type produced by {@code mapper}
705
     *
706
     * @return a {@code Collector} producing a {@link Stream} of mapped elements in parallel
707
     *
708
     * @since 3.2.0
709
     */
710
    public static <T, R> Collector<T, ?, Stream<R>> parallelToStream(
711
      Function<? super T, ? extends R> mapper,
712
      int parallelism) {
713
714 1 1. parallelToStream : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToStream → KILLED
        return Factory.streaming(mapper, Configurer.streaming(c -> c.parallelism(parallelism)));
715
    }
716
717
    /**
718
     * A convenience {@link Collector} that performs parallel computations by classifying elements
719
     * using the provided {@code classifier}, applying the given {@code mapper}, and producing a
720
     * {@link Stream} of {@link Grouped} elements as they become available.
721
     * <p>
722
     * Each group is processed independently on Virtual Threads, and every batch is guaranteed to
723
     * be executed on a single thread. The encounter order within each group is preserved.
724
     * A {@code parallelism} parameter limits the maximum number of concurrently processed groups.
725
     *
726
     * <br>
727
     * Example:
728
     * <pre>{@code
729
     * Stream.of(t1, t2, t3)
730
     *   .collect(parallelToStreamBy(Task::groupId, t -> compute(t), 2))
731
     *   .forEach(System.out::println);
732
     * }</pre>
733
     *
734
     * @param classifier  function that assigns each input element to a group
735
     * @param mapper      transformation applied to each element
736
     * @param parallelism the maximum degree of parallelism
737
     * @param <T>         the input element type
738
     * @param <K>         the classification key type
739
     * @param <R>         the mapped element type
740
     *
741
     * @return a {@code Collector} producing a {@link Stream} of {@link Grouped} elements
742
     * computed in parallel
743
     *
744
     * @since 3.4.0
745
     */
746
    public static <T, K, R> Collector<T, ?, Stream<Grouped<K, R>>> parallelToStreamBy(
747
      Function<? super T, ? extends K> classifier,
748
      Function<? super T, ? extends R> mapper,
749
      int parallelism) {
750
751 1 1. parallelToStreamBy : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToStreamBy → KILLED
        return Factory.streamingBy(classifier, mapper, Configurer.streaming(c -> c.parallelism(parallelism)));
752
    }
753
754
    /**
755
     * A convenience {@link Collector} that performs parallel computations on a custom {@link Executor}
756
     * with effectively unlimited parallelism and returns a {@link Stream} of the mapped elements as they arrive.
757
     * <p>
758
     * For a parallelism of 1, the stream is executed by the calling thread.
759
     *
760
     * <br>
761
     * Example:
762
     * <pre>{@code
763
     * Stream.of(1, 2, 3)
764
     *   .collect(parallelToStream(i -> foo(), executor))
765
     *   .forEach(System.out::println);
766
     * }</pre>
767
     *
768
     * @param mapper   a transformation applied to each element
769
     * @param executor the {@code Executor} used for asynchronous execution
770
     * @param <T>      the input element type
771
     * @param <R>      the type produced by {@code mapper}
772
     *
773
     * @return a {@code Collector} producing a {@link Stream} of mapped elements in parallel
774
     *
775
     * @since 3.3.0
776
     */
777
    public static <T, R> Collector<T, ?, Stream<R>> parallelToStream(
778
      Function<? super T, ? extends R> mapper,
779
      Executor executor) {
780
781 1 1. parallelToStream : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToStream → KILLED
        return Factory.streaming(mapper, Configurer.streaming(c -> c.executor(executor)));
782
    }
783
784
    /**
785
     * A convenience {@link Collector} that performs parallel computations by classifying elements
786
     * using the provided {@code classifier}, applying the given {@code mapper}, and producing a
787
     * {@link Stream} of {@link Grouped} elements as they become available.
788
     * <p>
789
     * Each group is processed independently on the supplied {@link Executor}, and every batch is
790
     * guaranteed to be executed on a single thread. The encounter order within each group is preserved.
791
     *
792
     * <br>
793
     * Example:
794
     * <pre>{@code
795
     * Stream.of(t1, t2, t3)
796
     *   .collect(parallelToStreamBy(Task::groupId, t -> compute(t), executor))
797
     *   .forEach(System.out::println);
798
     * }</pre>
799
     *
800
     * @param classifier function that assigns each input element to a group
801
     * @param mapper     transformation applied to each element
802
     * @param executor   the {@code Executor} used for asynchronous execution
803
     * @param <T>        the input element type
804
     * @param <K>        the classification key type
805
     * @param <R>        the mapped element type
806
     *
807
     * @return a {@code Collector} producing a {@link Stream} of {@link Grouped} elements
808
     * computed in parallel
809
     *
810
     * @since 3.4.0
811
     */
812
    public static <T, K, R> Collector<T, ?, Stream<Grouped<K, R>>> parallelToStreamBy(
813
      Function<? super T, ? extends K> classifier,
814
      Function<? super T, ? extends R> mapper,
815
      Executor executor) {
816
817 1 1. parallelToStreamBy : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToStreamBy → KILLED
        return Factory.streamingBy(classifier, mapper, Configurer.streaming(c -> c.executor(executor)));
818
    }
819
820
    /**
821
     * A convenience {@link Collector} that performs parallel computations on a custom {@link Executor}
822
     * and returns a {@link Stream} yielding results as soon as they are produced.
823
     * <p>
824
     * Each input element is submitted independently for asynchronous processing using the provided
825
     * {@code mapper}. Execution may proceed in parallel up to the configured {@code parallelism}.
826
     * When the parallelism is set to {@code 1}, all work is performed on the calling thread.
827
     * <p>
828
     * Ordering characteristics:
829
     * <ul>
830
     *   <li>The encounter order of input elements is not preserved.</li>
831
     *   <li>Results are emitted in the order in which they complete.</li>
832
     * </ul>
833
     * <p>
834
     * Example:
835
     * <pre>{@code
836
     * Stream.of(1, 2, 3)
837
     *   .collect(parallelToStream(i -> foo(i), executor, 2))
838
     *   .forEach(System.out::println);
839
     * }</pre>
840
     *
841
     * @param mapper      transformation applied to each element
842
     * @param executor    the {@code Executor} used for asynchronous execution
843
     * @param parallelism the maximum degree of parallelism
844
     * @param <T>         the input element type
845
     * @param <R>         the result type produced by {@code mapper}
846
     *
847
     * @return a {@code Collector} producing a {@link Stream} of mapped results as they complete
848
     *
849
     * @since 2.0.0
850
     */
851
    public static <T, R> Collector<T, ?, Stream<R>> parallelToStream(Function<? super T, ? extends R> mapper, Executor executor, int parallelism) {
852 1 1. parallelToStream : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToStream → KILLED
        return Factory.streaming(mapper,
853
          Configurer.streaming(c -> c
854
            .executor(executor)
855
            .parallelism(parallelism)));
856
    }
857
858
    /**
859
     * A convenience {@link Collector} that performs parallel computations on a custom {@link Executor},
860
     * ensuring that all elements classified into the same group are processed on a single thread.
861
     * <p>
862
     * Incoming elements are partitioned using the provided {@code classifier}. Each partition
863
     * (i.e., batch associated with a classification key) is executed as a unit, guaranteeing that all
864
     * elements within that batch are processed by the same thread. Different batches may run in
865
     * parallel depending on the configured {@code parallelism}.
866
     * <p>
867
     * Ordering guarantees:
868
     * <ul>
869
     *   <li>Elements within the same batch preserve their encounter order.</li>
870
     *   <li>Batches themselves may execute and complete in any order.</li>
871
     * </ul>
872
     * <p>
873
     * The resulting {@link Stream} emits mapped results as soon as they are produced. If
874
     * {@code parallelism} is set to {@code 1}, all work is executed on the calling thread.
875
     *
876
     * <br>
877
     * Example:
878
     * <pre>{@code
879
     * Stream.of(t1, t2, t3)
880
     *   .collect(parallelToStreamBy(Task::groupId, t -> compute(t), executor, 4))
881
     *   .forEach(System.out::println);
882
     * }</pre>
883
     *
884
     * @param classifier  function that assigns elements to groups; all elements with the same key
885
     *                    are guaranteed to run on the same thread
886
     * @param mapper      transformation applied to each element
887
     * @param executor    the {@code Executor} used for asynchronous execution
888
     * @param parallelism the maximum allowed parallelism
889
     * @param <T>         the input element type
890
     * @param <K>         the classification key type
891
     * @param <R>         the mapped result type
892
     *
893
     * @return a {@code Collector} producing a {@link Stream} of mapped results as they become available
894
     *
895
     * @since 3.4.0
896
     */
897
    public static <T, K, R> Collector<T, ?, Stream<Grouped<K, R>>> parallelToStreamBy(Function<? super T, ? extends K> classifier, Function<? super T, ? extends R> mapper, Executor executor, int parallelism) {
898 1 1. parallelToStreamBy : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToStreamBy → KILLED
        return Factory.streamingBy(classifier, mapper,
899
          Configurer.streaming(c -> c
900
            .executor(executor)
901
            .parallelism(parallelism)));
902
    }
903
904
    /**
905
     * A convenience {@link Collector} that performs parallel computations using Virtual Threads
906
     * and returns a {@link Stream} of the mapped elements as they arrive while maintaining the initial order.
907
     * <p>
908
     * For a parallelism of 1, the stream is executed by the calling thread.
909
     *
910
     * <br>
911
     * Example:
912
     * <pre>{@code
913
     * Stream.of(1, 2, 3)
914
     *   .collect(parallelToOrderedStream(i -> foo()))
915
     *   .forEach(System.out::println);
916
     * }</pre>
917
     *
918
     * @param mapper a transformation applied to each element
919
     * @param <T>    the input element type
920
     * @param <R>    the type produced by {@code mapper}
921
     *
922
     * @return a {@code Collector} producing a {@link Stream} of mapped elements in parallel, preserving order
923
     *
924
     * @since 3.0.0
925
     */
926
    public static <T, R> Collector<T, ?, Stream<R>> parallelToOrderedStream(
927
      Function<? super T, ? extends R> mapper) {
928
929 1 1. parallelToOrderedStream : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToOrderedStream → KILLED
        return Factory.streaming(mapper, Configurer.streaming(Configurer.Streaming::ordered));
930
    }
931
932
    /**
933
     * A convenience {@link Collector} that performs parallel computations by classifying elements
934
     * using the provided {@code classifier}, applying the given {@code mapper}, and producing a
935
     * {@link Stream} of {@link Grouped} elements as they become available while preserving the
936
     * original encounter order of input elements.
937
     * <p>
938
     * Ordering guarantees:
939
     * <ul>
940
     *   <li>The encounter order of input elements is preserved within the resulting {@link Stream}.</li>
941
     *   <li>Parallel execution does not affect the final ordering of elements in the resulting stream.</li>
942
     * </ul>
943
     * <p>
944
     * Each group is processed independently on Virtual Threads, and every batch is guaranteed to
945
     * be executed on a single thread.
946
     *
947
     * <br>
948
     * Example:
949
     * <pre>{@code
950
     * Stream.of(t1, t2, t3)
951
     *   .collect(parallelToOrderedStreamBy(Task::groupId, t -> compute(t)))
952
     *   .forEach(System.out::println);
953
     * }</pre>
954
     *
955
     * @param classifier function that assigns elements to groups
956
     * @param mapper     transformation applied to each element
957
     * @param <T>        the input element type
958
     * @param <K>        the classification key type
959
     * @param <R>        the mapped element type
960
     *
961
     * @return a {@code Collector} producing a {@link Stream} of {@link Grouped} elements
962
     * computed in parallel while preserving input order
963
     *
964
     * @since 3.4.0
965
     */
966
    public static <T, K, R> Collector<T, ?, Stream<Grouped<K, R>>> parallelToOrderedStreamBy(
967
      Function<? super T, ? extends K> classifier,
968
      Function<? super T, ? extends R> mapper) {
969
970 1 1. parallelToOrderedStreamBy : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToOrderedStreamBy → KILLED
        return Factory.streamingBy(classifier, mapper, Configurer.streaming(Configurer.Streaming::ordered));
971
    }
972
973
    /**
974
     * A convenience {@link Collector} that performs parallel computations using Virtual Threads
975
     * while preserving the encounter order of the input elements. Results are emitted in the same
976
     * order as the corresponding elements were encountered, regardless of when individual tasks
977
     * complete.
978
     * <p>
979
     * Each element is submitted independently for asynchronous processing on Virtual Threads using
980
     * the provided {@code mapper}. Execution may proceed in parallel up to the configured
981
     * {@code parallelism}. When the parallelism is set to {@code 1}, all work is performed on the
982
     * calling thread.
983
     * <p>
984
     * Ordering guarantees:
985
     * <ul>
986
     *   <li>The encounter order of input elements is preserved.</li>
987
     *   <li>Parallel execution does not affect the final ordering of the resulting stream.</li>
988
     * </ul>
989
     *
990
     * <br>
991
     * Example:
992
     * <pre>{@code
993
     * Stream.of(1, 2, 3)
994
     *   .collect(parallelToOrderedStream(i -> foo(i), 2))
995
     *   .forEach(System.out::println);
996
     * }</pre>
997
     *
998
     * @param mapper      transformation applied to each element
999
     * @param parallelism the maximum degree of parallelism
1000
     * @param <T>         the input element type
1001
     * @param <R>         the mapped result type
1002
     *
1003
     * @return a {@code Collector} producing an ordered {@link Stream} of mapped results
1004
     *
1005
     * @since 3.2.0
1006
     */
1007
    public static <T, R> Collector<T, ?, Stream<R>> parallelToOrderedStream(
1008
      Function<? super T, ? extends R> mapper,
1009
      int parallelism) {
1010 1 1. parallelToOrderedStream : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToOrderedStream → KILLED
        return Factory.streaming(mapper,
1011
          Configurer.streaming(c -> c
1012
            .ordered()
1013
            .parallelism(parallelism)));
1014
    }
1015
1016
    /**
1017
     * A convenience {@link Collector} that performs parallel computations using Virtual Threads
1018
     * while preserving the encounter order of both batches and the elements within each batch.
1019
     * <p>
1020
     * Incoming elements are partitioned using the provided {@code classifier}. Each partition
1021
     * (i.e., batch associated with a classification key) is processed as a unit. Although batches
1022
     * may execute in parallel up to the configured {@code parallelism}, their results are emitted
1023
     * strictly in encounter order.
1024
     * <p>
1025
     * Ordering guarantees:
1026
     * <ul>
1027
     *   <li>Elements within a batch preserve their encounter order.</li>
1028
     *   <li>Batches are emitted in the encounter order of their first element.</li>
1029
     *   <li>Parallel execution does not affect the final ordering of the resulting stream.</li>
1030
     * </ul>
1031
     * <p>
1032
     * When {@code parallelism} is {@code 1}, all processing is performed on the calling thread.
1033
     *
1034
     * <br>
1035
     * Example:
1036
     * <pre>{@code
1037
     * Stream.of(t1, t2, t3)
1038
     *   .collect(parallelToOrderedStreamBy(Task::groupId, t -> compute(t), 4))
1039
     *   .forEach(System.out::println);
1040
     * }</pre>
1041
     *
1042
     * @param classifier  function that groups elements into batches
1043
     * @param mapper      transformation applied to each element
1044
     * @param parallelism the maximum allowed parallelism
1045
     * @param <T>         the input element type
1046
     * @param <K>         the classification key type
1047
     * @param <R>         the mapped result type
1048
     *
1049
     * @return a {@code Collector} producing an ordered {@link Stream} of {@link Grouped} results
1050
     *
1051
     * @since 3.4.0
1052
     */
1053
    public static <T, K, R> Collector<T, ?, Stream<Grouped<K, R>>> parallelToOrderedStreamBy(
1054
      Function<? super T, ? extends K> classifier,
1055
      Function<? super T, ? extends R> mapper,
1056
      int parallelism) {
1057 1 1. parallelToOrderedStreamBy : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToOrderedStreamBy → KILLED
        return Factory.streamingBy(classifier, mapper,
1058
          Configurer.streaming(c -> c
1059
            .ordered()
1060
            .parallelism(parallelism)));
1061
    }
1062
1063
    /**
1064
     * A convenience {@link Collector} that performs parallel computations on a custom {@link Executor}
1065
     * while preserving the encounter order of the input elements. Results are emitted in the same order
1066
     * as the corresponding elements were encountered, regardless of when individual tasks complete.
1067
     * <p>
1068
     * Each element is submitted independently for asynchronous processing using the provided
1069
     * {@code mapper} and executed on the specified {@code executor}. Execution may proceed with
1070
     * effectively unlimited parallelism. When all work is performed on the calling thread
1071
     * ({@code parallelism} of 1), the stream behaves sequentially.
1072
     * <p>
1073
     * Ordering guarantees:
1074
     * <ul>
1075
     *   <li>The encounter order of input elements is preserved.</li>
1076
     *   <li>Parallel execution does not affect the final ordering of the resulting stream.</li>
1077
     * </ul>
1078
     *
1079
     * <br>
1080
     * Example:
1081
     * <pre>{@code
1082
     * Stream.of(1, 2, 3)
1083
     *   .collect(parallelToOrderedStream(i -> foo(i), executor))
1084
     *   .forEach(System.out::println);
1085
     * }</pre>
1086
     *
1087
     * @param mapper   transformation applied to each element
1088
     * @param executor the {@code Executor} used for asynchronous execution
1089
     * @param <T>      the input element type
1090
     * @param <R>      the mapped result type
1091
     *
1092
     * @return a {@code Collector} producing an ordered {@link Stream} of mapped results
1093
     *
1094
     * @since 3.3.0
1095
     */
1096
    public static <T, R> Collector<T, ?, Stream<R>> parallelToOrderedStream(
1097
      Function<? super T, ? extends R> mapper,
1098
      Executor executor) {
1099 1 1. parallelToOrderedStream : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToOrderedStream → KILLED
        return Factory.streaming(mapper,
1100
          Configurer.streaming(c -> c
1101
            .ordered()
1102
            .executor(executor)));
1103
    }
1104
1105
    /**
1106
     * A convenience {@link Collector} that performs parallel computations by classifying elements
1107
     * into batches using the provided {@code classifier}, executed on a custom {@link Executor},
1108
     * while preserving the encounter order of both batches and elements within each batch.
1109
     * <p>
1110
     * Each batch is processed as a unit on the specified executor. Results are emitted in the
1111
     * encounter order of the batches and the elements within them, even though batches may execute
1112
     * concurrently.
1113
     * <p>
1114
     * Ordering guarantees:
1115
     * <ul>
1116
     *   <li>Elements within a batch preserve their encounter order.</li>
1117
     *   <li>Batches are emitted in the encounter order of their first element.</li>
1118
     * </ul>
1119
     *
1120
     * <br>
1121
     * Example:
1122
     * <pre>{@code
1123
     * Stream.of(t1, t2, t3)
1124
     *   .collect(parallelToOrderedStreamBy(Task::groupId, t -> compute(t), executor))
1125
     *   .forEach(System.out::println);
1126
     * }</pre>
1127
     *
1128
     * @param classifier function that assigns elements to groups; all elements with the same key
1129
     *                   are guaranteed to run on the same thread
1130
     * @param mapper     transformation applied to each element
1131
     * @param executor   the {@code Executor} used for asynchronous execution
1132
     * @param <T>        the input element type
1133
     * @param <K>        the classification key type
1134
     * @param <R>        the mapped result type
1135
     *
1136
     * @return a {@code Collector} producing an ordered {@link Stream} of {@link Grouped} results
1137
     *
1138
     * @since 3.4.0
1139
     */
1140
    public static <T, K, R> Collector<T, ?, Stream<Grouped<K, R>>> parallelToOrderedStreamBy(
1141
      Function<? super T, ? extends K> classifier,
1142
      Function<? super T, ? extends R> mapper,
1143
      Executor executor) {
1144 1 1. parallelToOrderedStreamBy : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToOrderedStreamBy → KILLED
        return Factory.streamingBy(classifier, mapper,
1145
          Configurer.streaming(c -> c
1146
            .ordered()
1147
            .executor(executor)));
1148
    }
1149
1150
    /**
1151
     * A convenience {@link Collector} that performs parallel computations on a custom {@link Executor}
1152
     * while preserving the encounter order of input elements. Results are emitted in the same order
1153
     * as the corresponding elements were encountered, regardless of completion order.
1154
     * <p>
1155
     * Each element is submitted independently for asynchronous processing using the provided
1156
     * {@code mapper} and executed on the specified {@code executor}. Execution may proceed in
1157
     * parallel up to the configured {@code parallelism}. When {@code parallelism} is {@code 1},
1158
     * all work is executed on the calling thread.
1159
     * <p>
1160
     * Ordering guarantees:
1161
     * <ul>
1162
     *   <li>The encounter order of input elements is preserved.</li>
1163
     *   <li>Parallel execution does not affect the final ordering of the resulting stream.</li>
1164
     * </ul>
1165
     *
1166
     * <br>
1167
     * Example:
1168
     * <pre>{@code
1169
     * Stream.of(1, 2, 3)
1170
     *   .collect(parallelToOrderedStream(i -> foo(i), executor, 2))
1171
     *   .forEach(System.out::println);
1172
     * }</pre>
1173
     *
1174
     * @param mapper      transformation applied to each element
1175
     * @param executor    the {@code Executor} used for asynchronous execution
1176
     * @param parallelism the maximum degree of parallelism
1177
     * @param <T>         the input element type
1178
     * @param <R>         the mapped result type
1179
     *
1180
     * @return a {@code Collector} producing an ordered {@link Stream} of mapped results
1181
     *
1182
     * @since 2.0.0
1183
     */
1184
    public static <T, R> Collector<T, ?, Stream<R>> parallelToOrderedStream(
1185
      Function<? super T, ? extends R> mapper,
1186
      Executor executor,
1187
      int parallelism) {
1188
1189 1 1. parallelToOrderedStream : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToOrderedStream → KILLED
        return Factory.streaming(
1190
          mapper, Configurer.streaming(c -> c
1191
            .ordered()
1192
            .executor(executor)
1193
            .parallelism(parallelism))
1194
        );
1195
    }
1196
1197
    /**
1198
     * A convenience {@link Collector} that performs parallel computations by classifying elements
1199
     * into batches using the provided {@code classifier}, executed on a custom {@link Executor},
1200
     * while preserving the encounter order of both batches and elements within each batch.
1201
     * <p>
1202
     * Each batch is processed as a unit on the specified executor. Results are emitted in the
1203
     * encounter order of batches and of elements within each batch, even though batches may execute
1204
     * concurrently up to the configured {@code parallelism}.
1205
     * <p>
1206
     * Ordering guarantees:
1207
     * <ul>
1208
     *   <li>Elements within a batch preserve their encounter order.</li>
1209
     *   <li>Batches are emitted in the encounter order of their first element.</li>
1210
     * </ul>
1211
     *
1212
     * <br>
1213
     * Example:
1214
     * <pre>{@code
1215
     * Stream.of(t1, t2, t3)
1216
     *   .collect(parallelToOrderedStreamBy(Task::groupId, t -> compute(t), executor, 4))
1217
     *   .forEach(System.out::println);
1218
     * }</pre>
1219
     *
1220
     * @param classifier  function that assigns elements to groups; all elements with the same key
1221
     *                    are guaranteed to run on the same thread
1222
     * @param mapper      transformation applied to each element
1223
     * @param executor    the {@code Executor} used for asynchronous execution
1224
     * @param parallelism the maximum allowed parallelism
1225
     * @param <T>         the input element type
1226
     * @param <K>         the classification key type
1227
     * @param <R>         the mapped result type
1228
     *
1229
     * @return a {@code Collector} producing an ordered {@link Stream} of {@link Grouped} results
1230
     *
1231
     * @since 3.4.0
1232
     */
1233
    public static <T, K, R> Collector<T, ?, Stream<Grouped<K, R>>> parallelToOrderedStreamBy(
1234
      Function<? super T, ? extends K> classifier,
1235
      Function<? super T, ? extends R> mapper,
1236
      Executor executor,
1237
      int parallelism) {
1238
1239 1 1. parallelToOrderedStreamBy : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToOrderedStreamBy → KILLED
        return Factory.streamingBy(classifier, mapper,
1240
          Configurer.streaming(c -> c
1241
            .ordered()
1242
            .executor(executor)
1243
            .parallelism(parallelism)));
1244
    }
1245
1246
    /**
1247
     * A convenience {@code Collector} for collecting a {@code Stream<CompletableFuture<T>>}
1248
     * into a {@code CompletableFuture<R>} using a provided {@code Collector<T, ?, R>}
1249
     *
1250
     * @param collector the {@code Collector} describing the reduction
1251
     * @param <T>       the type of the collected elements
1252
     * @param <R>       the result of the transformation
1253
     *
1254
     * @return a {@code Collector} which collects all futures and combines them into a single future
1255
     * using the provided downstream {@code Collector}
1256
     *
1257
     * @since 2.3.0
1258
     */
1259
    public static <T, R> Collector<CompletableFuture<T>, ?, CompletableFuture<R>> toFuture(Collector<T, ?, R> collector) {
1260 1 1. toFuture : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::toFuture → KILLED
        return FutureCollectors.toFuture(collector);
1261
    }
1262
1263
    /**
1264
     * A convenience {@code Collector} for collecting a {@code Stream<CompletableFuture<T>>} into a {@code CompletableFuture<List<T>>}
1265
     *
1266
     * @param <T> the type of the collected elements
1267
     *
1268
     * @return a {@code Collector} which collects all futures and combines them into a single future
1269
     * returning a list of results
1270
     *
1271
     * @since 2.3.0
1272
     */
1273
    public static <T> Collector<CompletableFuture<T>, ?, CompletableFuture<List<T>>> toFuture() {
1274 1 1. toFuture : replaced return value with null for com/pivovarit/collectors/ParallelCollectors::toFuture → KILLED
        return FutureCollectors.toFuture();
1275
    }
1276
1277
    /**
1278
     * A subset of collectors which perform operations in batches and not separately (one object in a thread pool's worker queue represents a batch of operations to be performed by a single thread)
1279
     */
1280
    @Deprecated(forRemoval = true)
1281
    public static final class Batching {
1282
1283
        private Batching() {
1284
        }
1285
1286
        /**
1287
         * A convenience {@link Collector} used for executing parallel computations on a custom {@link Executor}
1288
         * and returning them as a {@link CompletableFuture} containing a result of the application of the user-provided {@link Collector}.
1289
         *
1290
         * <br>
1291
         * Example:
1292
         * <pre>{@code
1293
         * CompletableFuture<List<String>> result = Stream.of(1, 2, 3)
1294
         *   .collect(parallel(i -> foo(i), toList(), executor, 2));
1295
         * }</pre>
1296
         *
1297
         * @param mapper      a transformation to be performed in parallel
1298
         * @param collector   the {@code Collector} describing the reduction
1299
         * @param executor    the {@code Executor} to use for asynchronous execution
1300
         * @param parallelism the max parallelism level
1301
         * @param <T>         the type of the collected elements
1302
         * @param <R>         the result returned by {@code mapper}
1303
         * @param <RR>        the reduction result {@code collector}
1304
         *
1305
         * @return a {@code Collector} which collects all processed elements into a user-provided mutable {@code Collection} in parallel
1306
         *
1307
         * @since 2.1.0
1308
         */
1309
        public static <T, R, RR> Collector<T, ?, CompletableFuture<RR>> parallel(Function<? super T, ? extends R> mapper, Collector<R, ?, RR> collector, Executor executor, int parallelism) {
1310
            Objects.requireNonNull(collector, "collector cannot be null");
1311 2 1. lambda$parallel$0 : replaced return value with null for com/pivovarit/collectors/ParallelCollectors$Batching::lambda$parallel$0 → KILLED
2. parallel : replaced return value with null for com/pivovarit/collectors/ParallelCollectors$Batching::parallel → KILLED
            return Factory.collecting(s -> s.collect(collector), mapper,
1312
              Configurer.collecting(c -> c
1313
                .batching()
1314
                .executor(executor)
1315
                .parallelism(parallelism)));
1316
        }
1317
1318
        /**
1319
         * A convenience {@link Collector} used for executing parallel computations on a custom {@link Executor}
1320
         * and returning them as {@link CompletableFuture} containing a {@link Stream} of these elements.
1321
         *
1322
         * <br><br>
1323
         * The collector maintains the order of processed {@link Stream}. Instances should not be reused.
1324
         *
1325
         * <br>
1326
         * Example:
1327
         * <pre>{@code
1328
         * CompletableFuture<Stream<String>> result = Stream.of(1, 2, 3)
1329
         *   .collect(parallel(i -> foo(), executor, 2));
1330
         * }</pre>
1331
         *
1332
         * @param mapper      a transformation to be performed in parallel
1333
         * @param executor    the {@code Executor} to use for asynchronous execution
1334
         * @param parallelism the max parallelism level
1335
         * @param <T>         the type of the collected elements
1336
         * @param <R>         the result returned by {@code mapper}
1337
         *
1338
         * @return a {@code Collector} which collects all processed elements into a {@code Stream} in parallel
1339
         *
1340
         * @since 2.1.0
1341
         */
1342
        public static <T, R> Collector<T, ?, CompletableFuture<Stream<R>>> parallel(Function<? super T, ? extends R> mapper, Executor executor, int parallelism) {
1343 2 1. lambda$parallel$2 : replaced return value with Stream.empty for com/pivovarit/collectors/ParallelCollectors$Batching::lambda$parallel$2 → SURVIVED
2. parallel : replaced return value with null for com/pivovarit/collectors/ParallelCollectors$Batching::parallel → KILLED
            return Factory.collecting((Function<Stream<R>, Stream<R>>) i -> i, mapper,
1344
              Configurer.collecting(c -> c
1345
                .batching()
1346
                .executor(executor)
1347
                .parallelism(parallelism)));
1348
        }
1349
1350
        /**
1351
         * A convenience {@link Collector} used for executing parallel computations on a custom {@link Executor}
1352
         * and returning a {@link Stream} instance returning results as they arrive.
1353
         * <p>
1354
         * For the parallelism of 1, the stream is executed by the calling thread.
1355
         *
1356
         * <br>
1357
         * Example:
1358
         * <pre>{@code
1359
         * Stream.of(1, 2, 3)
1360
         *   .collect(parallelToStream(i -> foo(), executor, 2))
1361
         *   .forEach(System.out::println);
1362
         * }</pre>
1363
         *
1364
         * @param mapper      a transformation to be performed in parallel
1365
         * @param executor    the {@code Executor} to use for asynchronous execution
1366
         * @param parallelism the max parallelism level
1367
         * @param <T>         the type of the collected elements
1368
         * @param <R>         the result returned by {@code mapper}
1369
         *
1370
         * @return a {@code Collector} which collects all processed elements into a {@code Stream} in parallel
1371
         *
1372
         * @since 2.1.0
1373
         */
1374
        public static <T, R> Collector<T, ?, Stream<R>> parallelToStream(Function<? super T, ? extends R> mapper, Executor executor, int parallelism) {
1375 1 1. parallelToStream : replaced return value with null for com/pivovarit/collectors/ParallelCollectors$Batching::parallelToStream → KILLED
            return Factory.streaming(mapper,
1376
              Configurer.streaming(c -> c
1377
                .batching()
1378
                .executor(executor)
1379
                .parallelism(parallelism)));
1380
        }
1381
1382
        /**
1383
         * A convenience {@link Collector} used for executing parallel computations on a custom {@link Executor}
1384
         * and returning a {@link Stream} instance returning results as they arrive while maintaining the initial order.
1385
         * <p>
1386
         * For the parallelism of 1, the stream is executed by the calling thread.
1387
         *
1388
         * <br>
1389
         * Example:
1390
         * <pre>{@code
1391
         * Stream.of(1, 2, 3)
1392
         *   .collect(parallelToOrderedStream(i -> foo(), executor, 2))
1393
         *   .forEach(System.out::println);
1394
         * }</pre>
1395
         *
1396
         * @param mapper      a transformation to be performed in parallel
1397
         * @param executor    the {@code Executor} to use for asynchronous execution
1398
         * @param parallelism the max parallelism level
1399
         * @param <T>         the type of the collected elements
1400
         * @param <R>         the result returned by {@code mapper}
1401
         *
1402
         * @return a {@code Collector} which collects all processed elements into a {@code Stream} in parallel
1403
         *
1404
         * @since 2.1.0
1405
         */
1406
        public static <T, R> Collector<T, ?, Stream<R>> parallelToOrderedStream(Function<? super T, ? extends R> mapper, Executor executor, int parallelism) {
1407 1 1. parallelToOrderedStream : replaced return value with null for com/pivovarit/collectors/ParallelCollectors$Batching::parallelToOrderedStream → KILLED
            return Factory.streaming(mapper,
1408
              Configurer.streaming(c -> c
1409
                .ordered()
1410
                .batching()
1411
                .executor(executor)
1412
                .parallelism(parallelism)));
1413
        }
1414
    }
1415
}

Mutations

68

1.1
Location : parallel
Killed by : com.pivovarit.collectors.test.BasicProcessingTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicProcessingTest]/[test-factory:shouldProcessEmpty()]/[dynamic-test:#5]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallel → KILLED

2.2
Location : lambda$parallel$0
Killed by : com.pivovarit.collectors.test.BasicProcessingTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicProcessingTest]/[test-factory:shouldProcessEmpty()]/[dynamic-test:#5]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::lambda$parallel$0 → KILLED

108

1.1
Location : parallelBy
Killed by : com.pivovarit.collectors.test.BasicProcessingTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicProcessingTest]/[test-factory:shouldProcessEmpty()]/[dynamic-test:#14]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelBy → KILLED

2.2
Location : lambda$parallelBy$0
Killed by : com.pivovarit.collectors.test.BasicProcessingTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicProcessingTest]/[test-factory:shouldProcessEmpty()]/[dynamic-test:#14]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::lambda$parallelBy$0 → KILLED

143

1.1
Location : lambda$parallel$2
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#3]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::lambda$parallel$2 → KILLED

2.2
Location : parallel
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#3]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallel → KILLED

187

1.1
Location : lambda$parallelBy$2
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#8]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::lambda$parallelBy$2 → KILLED

2.2
Location : parallelBy
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#8]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelBy → KILLED

224

1.1
Location : lambda$parallel$4
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#4]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::lambda$parallel$4 → KILLED

2.2
Location : parallel
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#4]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallel → KILLED

271

1.1
Location : parallelBy
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#9]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelBy → KILLED

2.2
Location : lambda$parallelBy$4
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#9]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::lambda$parallelBy$4 → KILLED

309

1.1
Location : parallel
Killed by : com.pivovarit.collectors.test.BasicProcessingTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicProcessingTest]/[test-factory:shouldProcessEmpty()]/[dynamic-test:#7]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallel → KILLED

2.2
Location : lambda$parallel$6
Killed by : com.pivovarit.collectors.test.BasicProcessingTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicProcessingTest]/[test-factory:shouldProcessEmpty()]/[dynamic-test:#7]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::lambda$parallel$6 → KILLED

353

1.1
Location : lambda$parallelBy$6
Killed by : com.pivovarit.collectors.test.BasicProcessingTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicProcessingTest]/[test-factory:shouldProcessEmpty()]/[dynamic-test:#16]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::lambda$parallelBy$6 → KILLED

2.2
Location : parallelBy
Killed by : com.pivovarit.collectors.test.BasicProcessingTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicProcessingTest]/[test-factory:shouldProcessEmpty()]/[dynamic-test:#16]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelBy → KILLED

381

1.1
Location : parallel
Killed by : com.pivovarit.collectors.test.BasicProcessingTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicProcessingTest]/[test-factory:shouldProcessEmpty()]/[dynamic-test:#1]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallel → KILLED

2.2
Location : lambda$parallel$8
Killed by : com.pivovarit.collectors.test.BasicProcessingTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicProcessingTest]/[test-factory:shouldProcessAllElementsInOrder()]/[dynamic-test:#1]
replaced return value with Stream.empty for com/pivovarit/collectors/ParallelCollectors::lambda$parallel$8 → KILLED

415

1.1
Location : parallelBy
Killed by : com.pivovarit.collectors.test.BasicProcessingTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicProcessingTest]/[test-factory:shouldProcessEmpty()]/[dynamic-test:#10]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelBy → KILLED

444

1.1
Location : parallel
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#1]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallel → KILLED

2.2
Location : lambda$parallel$10
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessAllElementsWithMaxParallelism()]/[dynamic-test:#1]
replaced return value with Stream.empty for com/pivovarit/collectors/ParallelCollectors::lambda$parallel$10 → KILLED

480

1.1
Location : parallelBy
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#6]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelBy → KILLED

512

1.1
Location : lambda$parallel$12
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessAllElementsWithMaxParallelism()]/[dynamic-test:#2]
replaced return value with Stream.empty for com/pivovarit/collectors/ParallelCollectors::lambda$parallel$12 → KILLED

2.2
Location : parallel
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#2]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallel → KILLED

552

1.1
Location : parallelBy
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#7]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelBy → KILLED

586

1.1
Location : parallel
Killed by : com.pivovarit.collectors.test.BasicProcessingTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicProcessingTest]/[test-factory:shouldProcessEmpty()]/[dynamic-test:#3]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallel → KILLED

2.2
Location : lambda$parallel$14
Killed by : com.pivovarit.collectors.test.BasicProcessingTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicProcessingTest]/[test-factory:shouldProcessAllElementsInOrder()]/[dynamic-test:#3]
replaced return value with Stream.empty for com/pivovarit/collectors/ParallelCollectors::lambda$parallel$14 → KILLED

622

1.1
Location : parallelBy
Killed by : com.pivovarit.collectors.test.BasicProcessingTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicProcessingTest]/[test-factory:shouldProcessEmpty()]/[dynamic-test:#12]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelBy → KILLED

650

1.1
Location : parallelToStream
Killed by : com.pivovarit.collectors.test.BasicProcessingTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicProcessingTest]/[test-factory:shouldProcessEmpty()]/[dynamic-test:#18]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToStream → KILLED

684

1.1
Location : parallelToStreamBy
Killed by : com.pivovarit.collectors.test.BasicProcessingTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicProcessingTest]/[test-factory:shouldProcessEmpty()]/[dynamic-test:#23]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToStreamBy → KILLED

714

1.1
Location : parallelToStream
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#10]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToStream → KILLED

751

1.1
Location : parallelToStreamBy
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#13]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToStreamBy → KILLED

781

1.1
Location : parallelToStream
Killed by : com.pivovarit.collectors.test.BasicProcessingTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicProcessingTest]/[test-factory:shouldProcessEmpty()]/[dynamic-test:#20]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToStream → KILLED

817

1.1
Location : parallelToStreamBy
Killed by : com.pivovarit.collectors.test.BasicProcessingTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicProcessingTest]/[test-factory:shouldProcessEmpty()]/[dynamic-test:#25]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToStreamBy → KILLED

852

1.1
Location : parallelToStream
Killed by : com.pivovarit.collectors.test.StreamingTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.StreamingTest]/[method:shouldUseSyncFallback()]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToStream → KILLED

898

1.1
Location : parallelToStreamBy
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#14]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToStreamBy → KILLED

929

1.1
Location : parallelToOrderedStream
Killed by : com.pivovarit.collectors.test.ParallelismValidationTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.ParallelismValidationTest]/[test-factory:shouldThrowOnParallelStream()]/[dynamic-test:#15]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToOrderedStream → KILLED

970

1.1
Location : parallelToOrderedStreamBy
Killed by : com.pivovarit.collectors.test.BasicProcessingTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicProcessingTest]/[test-factory:shouldProcessEmpty()]/[dynamic-test:#32]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToOrderedStreamBy → KILLED

1010

1.1
Location : parallelToOrderedStream
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#15]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToOrderedStream → KILLED

1057

1.1
Location : parallelToOrderedStreamBy
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#18]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToOrderedStreamBy → KILLED

1099

1.1
Location : parallelToOrderedStream
Killed by : com.pivovarit.collectors.test.ParallelismValidationTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.ParallelismValidationTest]/[test-factory:shouldThrowOnParallelStream()]/[dynamic-test:#17]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToOrderedStream → KILLED

1144

1.1
Location : parallelToOrderedStreamBy
Killed by : com.pivovarit.collectors.test.BasicProcessingTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicProcessingTest]/[test-factory:shouldProcessEmpty()]/[dynamic-test:#34]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToOrderedStreamBy → KILLED

1189

1.1
Location : parallelToOrderedStream
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#16]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToOrderedStream → KILLED

1239

1.1
Location : parallelToOrderedStreamBy
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#19]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::parallelToOrderedStreamBy → KILLED

1260

1.1
Location : toFuture
Killed by : com.pivovarit.collectors.FutureCollectorsTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.FutureCollectorsTest]/[method:shouldCollectToList()]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::toFuture → KILLED

1274

1.1
Location : toFuture
Killed by : com.pivovarit.collectors.FutureCollectorsTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.FutureCollectorsTest]/[method:shouldCollect()]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors::toFuture → KILLED

1311

1.1
Location : lambda$parallel$0
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#5]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors$Batching::lambda$parallel$0 → KILLED

2.2
Location : parallel
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#5]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors$Batching::parallel → KILLED

1343

1.1
Location : parallel
Killed by : com.pivovarit.collectors.test.ExecutorPollutionTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.ExecutorPollutionTest]/[test-factory:shouldNotPolluteExecutorFactory()]/[dynamic-test:#9]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors$Batching::parallel → KILLED

2.2
Location : lambda$parallel$2
Killed by : none
replaced return value with Stream.empty for com/pivovarit/collectors/ParallelCollectors$Batching::lambda$parallel$2 → SURVIVED
Covering tests

1375

1.1
Location : parallelToStream
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#12]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors$Batching::parallelToStream → KILLED

1407

1.1
Location : parallelToOrderedStream
Killed by : com.pivovarit.collectors.test.BasicParallelismTest.[engine:junit-jupiter]/[class:com.pivovarit.collectors.test.BasicParallelismTest]/[test-factory:shouldProcessEmptyWithMaxParallelism()]/[dynamic-test:#17]
replaced return value with null for com/pivovarit/collectors/ParallelCollectors$Batching::parallelToOrderedStream → KILLED

Active mutators

Tests examined


Report generated by PIT 1.22.0