Skip to content

Commit

Permalink
Terminate MoreGatherers.zip(Iterator) when Iterator doesn't have next…
Browse files Browse the repository at this point in the history
… element (#61)
  • Loading branch information
pivovarit authored Oct 22, 2024
1 parent e0e50b1 commit d217a95
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@ public Supplier<Iterator<T2>> initializer() {

@Override
public Integrator<Iterator<T2>, T1, R> integrator() {
return (state, element, downstream) -> {
if (state.hasNext()) {
return downstream.push(mapper.apply(element, state.next()));
}
return true;
};
return (state, element, downstream) -> state.hasNext()
? downstream.push(mapper.apply(element, state.next()))
: state.hasNext();
}
}

0 comments on commit d217a95

Please sign in to comment.