Inline single-use variable
This commit is contained in:
parent
95eb7bc598
commit
c55dda383c
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue