In this chapter:
One of the coolest things about Tiger is that it offers so many new language features. When Java 1.3 and 1.4 were released, they had some new goodies, but most of the changes were either implementation issues (like all the Collection class restructuring), or things you didn’t use everyday (like proxies). Tiger is very different, though—you get to write new, funky-looking code, and that’s about as good as it gets for hardcore developers.
This chapter examines one of these
new language features, the
loop. This name is a bit deceiving, as the loop never uses the
as a result, it’s often
, and even sometimes
foreach. No matter what you call it, though, it’s mostly a convenience
function—it doesn’t make Java do anything particularly new, but it does
save some keystrokes. If you’re an
vi guy, that’s pretty nice—the
less you type, the more advanced a programmer you must be, right?
At its most basic, the
gets rid of the need to use the
java.util.Iterator class. That class, useful in looping over collections of objects, was rarely useful in and of itself. Instead, it made looping, and accessing the objects in that loop, possible. As ...