diff --git a/src/changes/changes.xml b/src/changes/changes.xml index d8d628ff5..3057795e1 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -27,6 +27,7 @@ Add layerd bloom filter clean method #476. Deprecate Closure in favor of java.util.function.Consumer. + Deprecate Factory in favor of java.util.function.Supplier. Bump org.apache.commons:commons-parent from 67 to 69 #473. Bump tests commons-io:commons-io from 2.16.0 to 2.16.1 #475 . diff --git a/src/main/java/org/apache/commons/collections4/Factory.java b/src/main/java/org/apache/commons/collections4/Factory.java index 38f6fa78f..527e31c24 100644 --- a/src/main/java/org/apache/commons/collections4/Factory.java +++ b/src/main/java/org/apache/commons/collections4/Factory.java @@ -16,6 +16,8 @@ */ package org.apache.commons.collections4; +import java.util.function.Supplier; + /** * Defines a functor interface implemented by classes that create objects. *

@@ -31,9 +33,10 @@ package org.apache.commons.collections4; * @param the type that the factory creates * * @since 2.1 + * @deprecated Use {@link Supplier}. */ -@FunctionalInterface -public interface Factory { +@Deprecated +public interface Factory extends Supplier { /** * Create a new object. @@ -43,4 +46,9 @@ public interface Factory { */ T create(); + @Override + default T get() { + return create(); + } + }