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) {
|
public static <E> void forEach(final Iterator<E> iterator, final Closure<? super E> closure) {
|
||||||
Objects.requireNonNull(closure, "closure");
|
Objects.requireNonNull(closure, "closure");
|
||||||
|
|
||||||
if (iterator != null) {
|
if (iterator != null) {
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
final E element = iterator.next();
|
closure.accept(iterator.next());
|
||||||
closure.accept(element);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue