FLINK-1276

Fixes FLINK-1276
The for-each syntax creates an iterator, while the for loop with indexes does not. 
I think this is not critical here, but in general, I have used the indexed access in some parts on purpose to avoid iterator creation and circumvent the danger of a concurrent modification exception.