Java Reference
In-Depth Information
1.
First, if the
ForUpdate
part is present, the expressions are evaluated in se-
quence from left to right; their values, if any, are discarded. If evaluation of
any expression completes abruptly for some reason, the
for
statement com-
pletes abruptly for the same reason; any
ForUpdate
statement expressions to
the right of the one that completed abruptly are not evaluated.
If the
ForUpdate
part is not present, no action is taken.
2.
Second, another
for
iteration step is performed.
• If the
Expression
is present and the value resulting from its evaluation (including
any possible unboxing) is
false
, no further action is taken and the
for
statement
completes normally.
If the (possibly unboxed) value of the
Expression
is
false
the first time it is eval-
uated, then the
Statement
is not executed.
If the
Expression
is not present, then the only way a
for
statement can complete normally is
by use of a
break
statement.
14.14.1.3. Abrupt Completion of for Statement
Abrupt completion of the contained
Statement
is handled in the following manner:
• If execution of the
Statement
completes abruptly because of a
break
with no label,
no further action is taken and the
for
statement completes normally.
• If execution of the
Statement
completes abruptly because of a
continue
with no la-
bel, then the following two steps are performed in sequence:
1.
First, if the
ForUpdate
part is present, the expressions are evaluated in se-
quence from left to right; their values, if any, are discarded.
If the
ForUpdate
part is not present, no action is taken.
2.
Second, another
for
iteration step is performed.
• If execution of the
Statement
completes abruptly because of a
continue
with label
L
,
then there is a choice:
♦ If the
for
statement has label
L
, then the following two steps are performed in
sequence:
1.
First, if the
ForUpdate
part is present, the expressions are evaluated in se-
quence from left to right; their values, if any, are discarded.
If the
ForUpdate
is not present, no action is taken.