diff --git a/src/main/java/org/apache/commons/collections4/functors/FunctorUtils.java b/src/main/java/org/apache/commons/collections4/functors/FunctorUtils.java index 67e8be657..93f4f7b2c 100644 --- a/src/main/java/org/apache/commons/collections4/functors/FunctorUtils.java +++ b/src/main/java/org/apache/commons/collections4/functors/FunctorUtils.java @@ -21,7 +21,6 @@ import java.util.Objects; import java.util.function.Consumer; import java.util.function.Function; -import org.apache.commons.collections4.Closure; import org.apache.commons.collections4.Predicate; import org.apache.commons.collections4.Transformer; @@ -32,21 +31,6 @@ import org.apache.commons.collections4.Transformer; */ final class FunctorUtils { - /** - * A very simple method that coerces Closure to Closure. - *

This method exists - * simply as centralized documentation and atomic unchecked warning - * suppression. - * - * @param the type of object the returned closure should "accept" - * @param closure the closure to coerce. - * @return the coerced closure. - */ - @SuppressWarnings("unchecked") - static Closure coerce(final Closure closure) { - return (Closure) closure; - } - /** * A very simple method that coerces Predicate to Predicate. * Due to the {@link Predicate#test(T)} method, Predicate is @@ -60,8 +44,8 @@ final class FunctorUtils { * @return the coerced predicate. */ @SuppressWarnings("unchecked") - static Predicate coerce(final Predicate predicate) { - return (Predicate) predicate; + static , P extends java.util.function.Predicate, T> R coerce(final P predicate) { + return (R) predicate; } /**