I'm afraid there's no other way than copy your counter to a second final variable and use that in your anonymous inner class. This is one of the "deficiencies" of Java around the topic of closures and an advertised advantage of sibling languages like Groovy.