The lambda you are passing to forEach()
is evaluated for each element received from the stream. The iteration itself is not visible from within the scope of the lambda, so you cannot continue
it as if forEach()
were a C preprocessor macro. Instead, you can conditionally skip the rest of the statements in it.