|
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 Location : initializer Killed by : com.pivovarit.gatherers.blackbox.ByIndexTest.[engine:junit-jupiter]/[class:com.pivovarit.gatherers.blackbox.ByIndexTest]/[method:shouldFilterByIndexEmptyStream()] replaced return value with null for com/pivovarit/gatherers/FilterByIndexGatherer::initializer → KILLED
|
| 22 |
|
1.1 Location : lambda$integrator$0 Killed by : none negated conditional → SURVIVED
Covering tests
Covered by tests:
- com.pivovarit.gatherers.blackbox.ByIndexTest.[engine:junit-jupiter]/[class:com.pivovarit.gatherers.blackbox.ByIndexTest]/[method:shouldFilterByIndex()]
2.2 Location : lambda$integrator$0 Killed by : none replaced boolean return with true for com/pivovarit/gatherers/FilterByIndexGatherer::lambda$integrator$0 → SURVIVED
Covering tests
Covered by tests:
- com.pivovarit.gatherers.blackbox.ByIndexTest.[engine:junit-jupiter]/[class:com.pivovarit.gatherers.blackbox.ByIndexTest]/[method:shouldFilterByIndex()]
3.3 Location : lambda$integrator$0 Killed by : com.pivovarit.gatherers.blackbox.ByIndexTest.[engine:junit-jupiter]/[class:com.pivovarit.gatherers.blackbox.ByIndexTest]/[method:shouldFilterByIndex()] negated conditional → KILLED
4.4 Location : integrator Killed by : com.pivovarit.gatherers.blackbox.ByIndexTest.[engine:junit-jupiter]/[class:com.pivovarit.gatherers.blackbox.ByIndexTest]/[method:shouldFilterByIndex()] replaced return value with null for com/pivovarit/gatherers/FilterByIndexGatherer::integrator → KILLED
|