Java 1.5: Difference between revisions

Content deleted Content added
Dwvanstone (talk | contribs)
1.5 released in 9/04.
Redirected. This is all covered in Java_programming_language#Version_history, no need for a seperate article about each version.
Line 1:
#REDIRECT [[Java programming language]]
'''Java 1.5''' (the "Tiger" release) was released in September 2004. Like all versions of [[Java programming language|Java]], it can be downloaded at no charge from [[Sun Microsystems|Sun]]'s website.
 
This version of Java contains long-awaited [[syntax]] shortcuts such as [[foreach]], [[autoboxing]] and [[typesafe enum]]s.
 
==For each==
 
This code snippet shows the old and new [[for loop]] syntax.
 
List<String> curses = new ArrayList<String>();<BR>
curses.add("foo");
curses.add("bar");
curses.add("snafu");<BR>
// The old iterator...
String result = "";<BR>
for (Iterator it = curses.iterator(); it.hasNext(); ) {
result += (String)it.next();
}<BR>
assert result.equals("foobarsnafu");<BR>
// The new Java 1.5 iterator...<BR>
result = "";
for (String s: curses) { result += s; } // fits neatly on one line!<BR>
assert result.equals("foobarsnafu");
 
 
==Links==
*[http://java.sun.com/features/2003/05/bloch_qa.html New Language Features for Ease of Development in the Java 2 Platform, Standard Edition 1.5: A Conversation with Joshua Bloch]
*[http://java.sun.com/developer/technicalArticles/releases/j2se15/ J2SE 5.0 in a Nutshell]