[Functional] FunctorUtils.validate(Closure...) is now

FunctorUtils.validate(Consumer...)
This commit is contained in:
Gary Gregory 2024-07-09 22:21:18 -04:00
parent 4894606d6d
commit 71a3d088c4
2 changed files with 8 additions and 6 deletions

View File

@ -30,6 +30,7 @@
<action type="fix" dev="ggregory" due-to="Gary Gregory">Add missing Javadocs.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">PatriciaTrie constructor reuse the stateless singleton StringKeyAnalyzer.INSTANCE.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate StringKeyAnalyzer.StringKeyAnalyzer() in favor of StringKeyAnalyzer.INSTANCE.</action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">[Functional] FunctorUtils.validate(Closure...) is now FunctorUtils.validate(Consumer...).</action>
<!-- ADD -->
<!-- UPDATE -->
<action issue="COLLECTIONS-857" type="update" dev="ggregory" due-to="Claude Warren">Update bloom filter documentation #508.</action>

View File

@ -18,6 +18,7 @@ package org.apache.commons.collections4.functors;
import java.util.Collection;
import java.util.Objects;
import java.util.function.Consumer;
import org.apache.commons.collections4.Closure;
import org.apache.commons.collections4.Predicate;
@ -123,14 +124,14 @@ final class FunctorUtils {
}
/**
* Validate the closures to ensure that all is well.
* Validates the consumers to ensure that all is well.
*
* @param closures the closures to validate
* @param consumers the consumers to validate.
*/
static void validate(final Closure<?>... closures) {
Objects.requireNonNull(closures, "closures");
for (int i = 0; i < closures.length; i++) {
if (closures[i] == null) {
static void validate(final Consumer<?>... consumers) {
Objects.requireNonNull(consumers, "closures");
for (int i = 0; i < consumers.length; i++) {
if (consumers[i] == null) {
throw new NullPointerException("closures[" + i + "]");
}
}