There have been a lot of enhancements to existing features in Java 1.5 (5.0). One of the simplest improvements is to the most commonly used for loop.
Here’s how it worked prior to version 1.5:
vec is a VectorSomeObject obj;for(int i=0;i<vec.size();i++){ obj = (SomeObject) aVec.elementAt(i); //code to use obj}
Now, here's how it works in version 1.5:
for (Object aVec : vec){ obj = (SomeObject) aVec; //code to use obj}As you can see, the loop incrementor is now handled implicitly.
Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.























