Deprecate Factory in favor of java.util.function.Supplier

This commit is contained in:
Gary Gregory 2024-04-28 09:30:31 -04:00
parent c17637259b
commit e5c3d7ec12
2 changed files with 11 additions and 2 deletions

View File

@ -27,6 +27,7 @@
<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>
<action type="update" dev="ggregory" due-to="Gary Gregory">Deprecate Factory in favor of java.util.function.Supplier.</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>

View File

@ -16,6 +16,8 @@
*/
package org.apache.commons.collections4;
import java.util.function.Supplier;
/**
* Defines a functor interface implemented by classes that create objects.
* <p>
@ -31,9 +33,10 @@ package org.apache.commons.collections4;
* @param <T> the type that the factory creates
*
* @since 2.1
* @deprecated Use {@link Supplier}.
*/
@FunctionalInterface
public interface Factory<T> {
@Deprecated
public interface Factory<T> extends Supplier<T> {
/**
* Create a new object.
@ -43,4 +46,9 @@ public interface Factory<T> {
*/
T create();
@Override
default T get() {
return create();
}
}