diff --git a/src/main/java/org/apache/commons/collections4/IteratorUtils.java b/src/main/java/org/apache/commons/collections4/IteratorUtils.java index 856c4b8572..b237316abe 100644 --- a/src/main/java/org/apache/commons/collections4/IteratorUtils.java +++ b/src/main/java/org/apache/commons/collections4/IteratorUtils.java @@ -28,6 +28,7 @@ import java.util.ListIterator; import java.util.Map; import java.util.Objects; +import java.util.function.Consumer; import org.apache.commons.collections4.functors.EqualPredicate; import org.apache.commons.collections4.iterators.ArrayIterator; @@ -710,7 +711,7 @@ public static E first(final Iterator iterator) { * @throws NullPointerException if closure is null * @since 4.1 */ - public static void forEach(final Iterator iterator, final Closure closure) { + public static void forEach(final Iterator iterator, final Consumer closure) { Objects.requireNonNull(closure, "closure"); if (iterator != null) { while (iterator.hasNext()) {