From 23b9caebf5d5cf55116a85db96dbf03fc1911331 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Fri, 20 Jul 2018 07:27:02 +0100 Subject: [PATCH] KeyRemoved.flatIfFound refactored to use conditional --- src/main/java/net/kemitix/gitdb/impl/KeyRemover.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/kemitix/gitdb/impl/KeyRemover.java b/src/main/java/net/kemitix/gitdb/impl/KeyRemover.java index 847db08..b1e28ca 100644 --- a/src/main/java/net/kemitix/gitdb/impl/KeyRemover.java +++ b/src/main/java/net/kemitix/gitdb/impl/KeyRemover.java @@ -30,6 +30,8 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; import java.util.function.Predicate; +import static net.kemitix.conditional.Condition.where; + /** * Remove Key from the Git Repository. * @@ -66,11 +68,8 @@ class KeyRemover { * @return a Consumer */ private static Consumer flagIfFound(final String key, final AtomicBoolean removed) { - return nvb -> { - if (nvb.getName().equals(key)) { - removed.set(true); - } - }; + return nvb -> where(nvb.getName().equals(key)) + .then(() -> removed.set(true)); } /**