Skip to content

Commit

Permalink
Deprecate Predicate in favor of java.util.function.Predicate
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Apr 28, 2024
1 parent e5c3d7e commit c208c4a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<!-- FIX -->
<action type="update" dev="ggregory" due-to="Gary Gregory">Deprecate Closure in favor of java.util.function.Consumer.</action>
<action type="update" dev="ggregory" due-to="Gary Gregory">Deprecate Factory in favor of java.util.function.Supplier.</action>
<action type="update" dev="ggregory" due-to="Gary Gregory">Deprecate Predicate in favor of java.util.function.Predicate.</action>
<!-- UPDATE -->
<action type="update" dev="ggregory" due-to="Dependabot">Bump org.apache.commons:commons-parent from 67 to 69 #473.</action>
<action type="update" dev="ggregory" due-to="Dependabot">Bump tests commons-io:commons-io from 2.16.0 to 2.16.1 #475 .</action>
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/org/apache/commons/collections4/Predicate.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@
* @param <T> the type that the predicate queries
*
* @since 1.0
* @deprecated Use {@link java.util.function.Predicate}.
*/
@FunctionalInterface
public interface Predicate<T> {
@Deprecated
public interface Predicate<T> extends java.util.function.Predicate<T> {

/**
* Use the specified parameter to perform a test that returns true or false.
Expand All @@ -48,4 +49,9 @@ public interface Predicate<T> {
*/
boolean evaluate(T object);

@Override
default boolean test(final T t) {
return evaluate(t);
}

}

0 comments on commit c208c4a

Please sign in to comment.