This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git


The following commit(s) were added to refs/heads/master by this push:
     new c55dda383 Inline single-use variable
c55dda383 is described below

commit c55dda383c1cb5e4b1957d49ff3377286e56e972
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Wed Jul 10 08:20:18 2024 -0400

    Inline single-use variable
---
 src/main/java/org/apache/commons/collections4/IteratorUtils.java | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/commons/collections4/IteratorUtils.java 
b/src/main/java/org/apache/commons/collections4/IteratorUtils.java
index a4d9d8614..4cae230de 100644
--- a/src/main/java/org/apache/commons/collections4/IteratorUtils.java
+++ b/src/main/java/org/apache/commons/collections4/IteratorUtils.java
@@ -712,11 +712,9 @@ public class IteratorUtils {
      */
     public static <E> void forEach(final Iterator<E> iterator, final Closure<? 
super E> closure) {
         Objects.requireNonNull(closure, "closure");
-
         if (iterator != null) {
             while (iterator.hasNext()) {
-                final E element = iterator.next();
-                closure.accept(element);
+                closure.accept(iterator.next());
             }
         }
     }

Reply via email to