This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit 7183328297d0e3ef0d7f73e09945dfc7cc60c0c6
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Thu Jul 11 11:03:55 2024 -0400

    Migrate toward java.util.function
    
    - Package-private changes only
    - Maintains binary and source compatibility
---
 .../commons/collections4/functors/FunctorUtils.java  | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

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

Reply via email to