...
| Code Block | ||||
|---|---|---|---|---|
| ||||
// ...
for (final Integer i: list) {
if (first) {
first = false;
i = new Integer(99); // compiler error: variable i might already have been assigned
}
// ...
|
Compliant Solution
This compliant solution processes the "modified" list but leaves the actual list unchanged:
...