1 | package com.pivovarit.gatherers; | |
2 | ||
3 | import java.util.Objects; | |
4 | import java.util.concurrent.atomic.AtomicLong; | |
5 | import java.util.function.BiFunction; | |
6 | import java.util.function.Supplier; | |
7 | import java.util.stream.Gatherer; | |
8 | ||
9 | record ZipWithIndexMappingGatherer<T, R>(BiFunction<Long, ? super T, ? extends R> mapper) | |
10 | implements Gatherer<T, AtomicLong, R> { | |
11 | ||
12 | ZipWithIndexMappingGatherer { | |
13 | Objects.requireNonNull(mapper, "mapper can't be null"); | |
14 | } | |
15 | ||
16 | @Override | |
17 | public Supplier<AtomicLong> initializer() { | |
18 |
1
1. initializer : replaced return value with null for com/pivovarit/gatherers/ZipWithIndexMappingGatherer::initializer → KILLED |
return AtomicLong::new; |
19 | } | |
20 | ||
21 | @Override | |
22 | public Integrator<AtomicLong, T, R> integrator() { | |
23 |
3
1. lambda$integrator$0 : replaced boolean return with true for com/pivovarit/gatherers/ZipWithIndexMappingGatherer::lambda$integrator$0 → SURVIVED 2. lambda$integrator$0 : replaced boolean return with false for com/pivovarit/gatherers/ZipWithIndexMappingGatherer::lambda$integrator$0 → SURVIVED 3. integrator : replaced return value with null for com/pivovarit/gatherers/ZipWithIndexMappingGatherer::integrator → KILLED |
return Integrator.ofGreedy((state, element, downstream) -> downstream.push(mapper.apply(state.getAndIncrement(), element))); |
24 | } | |
25 | } | |
Mutations | ||
18 |
1.1 |
|
23 |
1.1 2.2 3.3 |