Skip to content

Commit

Permalink
Deprecate Closure in favor of java.util.function.Consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Apr 28, 2024
1 parent b678b30 commit c176372
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
<body>
<release version="4.5.0" date="YYYY-MM-DD" description="This milestone release requires Java 8 and adds the package `org.apache.commons.collections4.bloomfilter`.">
<!-- ADD -->
<action issue="COLLECTIONS-852" type="update" dev="ggregory" due-to="Claude Warren, Alex Herbert">Add layerd bloom filter clean method #476 .</action>
<action issue="COLLECTIONS-852" type="update" dev="ggregory" due-to="Claude Warren, Alex Herbert">Add layerd bloom filter clean method #476.</action>
<!-- FIX -->
<action type="update" dev="ggregory" due-to="Gary Gregory">Deprecate Closure in favor of java.util.function.Consumer.</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
12 changes: 10 additions & 2 deletions src/main/java/org/apache/commons/collections4/Closure.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package org.apache.commons.collections4;

import java.util.function.Consumer;

/**
* Defines a functor interface implemented by classes that do something.
* <p>
Expand All @@ -29,9 +31,15 @@
*
* @param <T> the type that the closure acts on
* @since 1.0
* @deprecated Use {@link Consumer}.
*/
@FunctionalInterface
public interface Closure<T> {
@Deprecated
public interface Closure<T> extends Consumer<T> {

@Override
default void accept(final T input) {
execute(input);
}

/**
* Performs an action on the specified input object.
Expand Down

0 comments on commit c176372

Please sign in to comment.