From 5b9f44731620a92c74d1c8f30c26151c37317bfe Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Mon, 21 Oct 2024 22:15:40 +0200 Subject: [PATCH] Use Greedy integrator for MoreGatherers.distinctByKeepLast() (#59) --- .../com/pivovarit/gatherers/DistinctByKeepLastGatherer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/pivovarit/gatherers/DistinctByKeepLastGatherer.java b/src/main/java/com/pivovarit/gatherers/DistinctByKeepLastGatherer.java index 0f7f88b..4d78037 100644 --- a/src/main/java/com/pivovarit/gatherers/DistinctByKeepLastGatherer.java +++ b/src/main/java/com/pivovarit/gatherers/DistinctByKeepLastGatherer.java @@ -21,10 +21,10 @@ public Supplier> initializer() { @Override public Integrator, T, T> integrator() { - return (state, element, _) -> { + return Integrator.ofGreedy((state, element, _) -> { state.put(keyExtractor.apply(element), element); return true; - }; + }); } @Override