ZipIteratorGatherer.java

1
package com.pivovarit.gatherers;
2
3
import java.util.Iterator;
4
import java.util.Objects;
5
import java.util.function.BiFunction;
6
import java.util.function.Supplier;
7
import java.util.stream.Gatherer;
8
9
record ZipIteratorGatherer<T1, T2, R>(Iterator<T2> iterator, BiFunction<? super T1, ? super T2, ? extends R> mapper)
10
  implements Gatherer<T1, Iterator<T2>, R> {
11
12
    ZipIteratorGatherer {
13
        Objects.requireNonNull(mapper, "mapper can't be null");
14
        Objects.requireNonNull(iterator, "iterator can't be null");
15
    }
16
17
    @Override
18
    public Supplier<Iterator<T2>> initializer() {
19 2 1. initializer : replaced return value with null for com/pivovarit/gatherers/ZipIteratorGatherer::initializer → KILLED
2. lambda$initializer$0 : replaced return value with null for com/pivovarit/gatherers/ZipIteratorGatherer::lambda$initializer$0 → KILLED
        return () -> iterator;
20
    }
21
22
    @Override
23
    public Integrator<Iterator<T2>, T1, R> integrator() {
24 4 1. lambda$integrator$1 : replaced boolean return with true for com/pivovarit/gatherers/ZipIteratorGatherer::lambda$integrator$1 → SURVIVED
2. lambda$integrator$1 : negated conditional → KILLED
3. lambda$integrator$1 : replaced boolean return with false for com/pivovarit/gatherers/ZipIteratorGatherer::lambda$integrator$1 → KILLED
4. integrator : replaced return value with null for com/pivovarit/gatherers/ZipIteratorGatherer::integrator → KILLED
        return (state, element, downstream) -> state.hasNext()
25
          ? downstream.push(mapper.apply(element, state.next()))
26
          : state.hasNext();
27
    }
28
}

Mutations

19

1.1
Location : initializer
Killed by : com.pivovarit.gatherers.blackbox.ZipIteratorMapperTest.[engine:junit-jupiter]/[class:com.pivovarit.gatherers.blackbox.ZipIteratorMapperTest]/[method:shouldZipEmpty()]
replaced return value with null for com/pivovarit/gatherers/ZipIteratorGatherer::initializer → KILLED

2.2
Location : lambda$initializer$0
Killed by : com.pivovarit.gatherers.blackbox.ZipIteratorMapperTest.[engine:junit-jupiter]/[class:com.pivovarit.gatherers.blackbox.ZipIteratorMapperTest]/[method:shouldZipWithEmpty()]
replaced return value with null for com/pivovarit/gatherers/ZipIteratorGatherer::lambda$initializer$0 → KILLED

24

1.1
Location : lambda$integrator$1
Killed by : com.pivovarit.gatherers.blackbox.ZipIteratorMapperTest.[engine:junit-jupiter]/[class:com.pivovarit.gatherers.blackbox.ZipIteratorMapperTest]/[method:shouldZipWithEmpty()]
negated conditional → KILLED

2.2
Location : lambda$integrator$1
Killed by : none
replaced boolean return with true for com/pivovarit/gatherers/ZipIteratorGatherer::lambda$integrator$1 → SURVIVED
Covering tests

3.3
Location : lambda$integrator$1
Killed by : com.pivovarit.gatherers.blackbox.ZipIteratorTest.[engine:junit-jupiter]/[class:com.pivovarit.gatherers.blackbox.ZipIteratorTest]/[method:shouldZipWithShorter()]
replaced boolean return with false for com/pivovarit/gatherers/ZipIteratorGatherer::lambda$integrator$1 → KILLED

4.4
Location : integrator
Killed by : com.pivovarit.gatherers.blackbox.ZipIteratorMapperTest.[engine:junit-jupiter]/[class:com.pivovarit.gatherers.blackbox.ZipIteratorMapperTest]/[method:shouldZipWithEmpty()]
replaced return value with null for com/pivovarit/gatherers/ZipIteratorGatherer::integrator → KILLED

Active mutators

Tests examined


Report generated by PIT 1.17.1