Inline single-use variable

This commit is contained in:
Gary Gregory 2024-07-10 08:20:18 -04:00
parent 95eb7bc598
commit c55dda383c
1 changed files with 1 additions and 3 deletions

View File

@ -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());
}
}
}