1 | package com.pivovarit.gatherers; | |
2 | ||
3 | import java.util.Objects; | |
4 | import java.util.concurrent.atomic.AtomicLong; | |
5 | import java.util.function.BiPredicate; | |
6 | import java.util.function.Supplier; | |
7 | import java.util.stream.Gatherer; | |
8 | ||
9 | record FilterByIndexGatherer<T>(BiPredicate<Long, ? super T> predicate) implements Gatherer<T, AtomicLong, T> { | |
10 | ||
11 | FilterByIndexGatherer { | |
12 | Objects.requireNonNull(predicate); | |
13 | } | |
14 | ||
15 | @Override | |
16 | public Supplier<AtomicLong> initializer() { | |
17 |
1
1. initializer : replaced return value with null for com/pivovarit/gatherers/FilterByIndexGatherer::initializer → KILLED |
return AtomicLong::new; |
18 | } | |
19 | ||
20 | @Override | |
21 | public Integrator<AtomicLong, T, T> integrator() { | |
22 |
4
1. lambda$integrator$0 : negated conditional → SURVIVED 2. lambda$integrator$0 : replaced boolean return with true for com/pivovarit/gatherers/FilterByIndexGatherer::lambda$integrator$0 → SURVIVED 3. lambda$integrator$0 : negated conditional → KILLED 4. integrator : replaced return value with null for com/pivovarit/gatherers/FilterByIndexGatherer::integrator → KILLED |
return Integrator.ofGreedy((seq, t, downstream) -> predicate.test(seq.getAndIncrement(), t) && downstream.push(t)); |
23 | } | |
24 | } | |
Mutations | ||
17 |
1.1 |
|
22 |
1.1 2.2 3.3 4.4 |