Busted Mug

A blog that documents solutions to the most frustrating problems that occur during development in technologies such as Java, XML, AJAX, SQL, CSS and others that make me want to throw my coffee mug against the cube wall.

Tuesday, November 28, 2006

Foreach in Java

As a php to java convert (mandated by my employer) I always forget the java version of for each. Sun, of course, has a good for each reference and tutorial but it is a little long winded. to break it down:
    for (TimerTask t : c)
means "For each tasktimer in c, assign it to t and do .cancel." These make your code much more elegant. I use them whenever possible.


Post a Comment

<< Home