Skip to content

Commit

Permalink
[Functional] FunctorUtils.validate(Closure...) is now
Browse files Browse the repository at this point in the history
FunctorUtils.validate(Consumer...)
  • Loading branch information
garydgregory committed Jul 10, 2024
1 parent 4894606 commit 71a3d08
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

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;
Expand Down Expand Up @@ -123,14 +124,14 @@ static <I, O> Transformer<I, O>[] copy(final Transformer<? super I, ? extends O>
}

/**
* 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 + "]");
}
}
Expand Down

0 comments on commit 71a3d08

Please sign in to comment.