Erran Morad
Erran Morad

Reputation: 4743

How to debug for each loop using index?

I have a Java for each loop like this :

public void doManyThings() {
    for (Thing thing : arrayListOfThings) {
        thing.doThing();
    }
}

In Intellij IDEA, I want to set a conditional breakpoint which breaks at a particular index. How do I do this, without adding an index in the code or making any other modification to the code ?

Upvotes: 0

Views: 544

Answers (1)

racraman
racraman

Reputation: 5034

If the members of arrayListOfThings are unique, then you could use a conditional breakpoint something like :

thing == arrayListOfThings.get(3)

Upvotes: 1

Related Questions