Typesafe Enums, Autoboxing, ... (JSR 201)

View: [ 2009 | 2008 | 2007 | 2006 | 2005 | 2004 | 2003 ]

Articles
  

Articles:
  • Nuances of the Java 5.0 for-each Loop by Nishanth Sastry   - [Clicks: 7]
    This article is an in-depth examination of one of the simplest but most pleasing features in Java 5.0--the for-each loop. I present eleven short items discussing various nuances of usage, pitfalls to be aware of, and possible optimizations surrounding the use of the for-each loop. In the first section, I discuss what kind of iterations are possible with the for-each. The next section illustrates common programming errors in using the for-each loop. The final section shows how to write new classes that can be used as targets of a for-each loop. I also talk about advanced implementations that allow multiple iterable views; lazily construct objects just in time for iteration; and enable possible generic algorithm and compiler optimizations of the for-each loop.
    http://today.java.net/pub/a/today/2006/11/07/nuances-of-java-5-for-each-loop.html - Nov, 2006

[Top]