...
Consequently, an assignment to the loop variable is equivalent to modifying a variable local to the loop body whose initial value is the object referenced by the loop iterator. This modification is not necessarily erroneous, but it can obscure the loop functionality or indicate a misunderstanding of the underlying implementation of the enhanced for statement.
Declare all All enhanced for statement loop variables should be declared as final. The final declaration causes Java compilers to flag and reject any assignments made to the loop variable.
...