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)
t.cancel();
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.


0 Comments:
Post a Comment
<< Home