KeyRemoved.flatIfFound refactored to use conditional

This commit is contained in:
Paul Campbell 2018-07-20 07:27:02 +01:00
parent 0a24a399aa
commit 23b9caebf5

View file

@ -30,6 +30,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Predicate; import java.util.function.Predicate;
import static net.kemitix.conditional.Condition.where;
/** /**
* Remove Key from the Git Repository. * Remove Key from the Git Repository.
* *
@ -66,11 +68,8 @@ class KeyRemover {
* @return a Consumer * @return a Consumer
*/ */
private static Consumer<NamedRevBlob> flagIfFound(final String key, final AtomicBoolean removed) { private static Consumer<NamedRevBlob> flagIfFound(final String key, final AtomicBoolean removed) {
return nvb -> { return nvb -> where(nvb.getName().equals(key))
if (nvb.getName().equals(key)) { .then(() -> removed.set(true));
removed.set(true);
}
};
} }
/** /**