Accessing iterator in enhanced for construct
posted 9 years ago
No, for that you need to use the old-style for loop. They considered some ways that the for loop might have been made more powerful - access to the index, or to the iterator's remove() method, etc - but instead decided to keep the syntax as simple as possible, as that covers, what, 80% or more of the cases where you use a for loop? And the remaining more complex cases can always be handled by the original for loop syntax.