Skip to content

Commit

Permalink
Inline single-use variable
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Jul 10, 2024
1 parent 95eb7bc commit c55dda3
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -712,11 +712,9 @@ public static <E> E first(final Iterator<E> iterator) {
*/
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());
}
}
}
Expand Down

0 comments on commit c55dda3

Please sign in to comment.