Skip to content

Commit

Permalink
Implement Greedy
Browse files Browse the repository at this point in the history
  • Loading branch information
tginsberg committed Jan 22, 2025
1 parent 31006b0 commit 786aa30
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/ginsberg/gatherers4j/EveryNthGatherer.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ public Supplier<State> initializer() {

@Override
public Integrator<EveryNthGatherer.State, INPUT, INPUT> integrator() {
return (state, element, downstream) -> {
return Integrator.ofGreedy((state, element, downstream) -> {
if (state.size++ % count == 0) {
downstream.push(element);
}
return !downstream.isRejecting();
};
});
}

public static class State {
Expand Down

0 comments on commit 786aa30

Please sign in to comment.