Java for-each loop - Is it possible to get the index?

Posted by Amir Rachum on Stack Overflow See other posts from Stack Overflow or by Amir Rachum
Published on 2010-04-20T23:34:20Z Indexed on 2010/04/20 23:43 UTC
Read the original article Hit count: 229

Filed under:
|

Is it possible to use a for-each loop in Java and somehow still get the index of the iteration?

for (Object obj : ListOfObject) {
    // I want to know the index of obj!
}

© Stack Overflow or respective owner

Related posts about java

Related posts about for-loop