Java version history: Difference between revisions

Content deleted Content added
MarkSweep (talk | contribs)
External links: fix links
Line 56:
* [[Autoboxing]]/unboxing &mdash; automatic conversions between [[primitive type]]s (such as <code>int</code>) and [[primitive wrapper class]]es (such as {{Javadoc:SE|java/lang|Integer}}). (Specified by [http://www.jcp.org/en/jsr/detail?id=201 JSR 201].)
* [[Enumeration (programming)|Enumerations]] &mdash; the <code>enum</code> keyword creates a [[type safety|typesafe]], ordered list of values (such as <code>Day.MONDAY</code>, <code>Day.TUESDAY</code>, etc.). Previously this could only be achieved by non-typesafe constant integers or manually constructed classes (typesafe enum pattern). (Specified by [http://www.jcp.org/en/jsr/detail?id=201 JSR 201].)
* [[Variadic function|Varargs]] &mdash; the last parameter of a method can now be declared using a type name followed by three dots (e.g. <code>void drawtext(String... lines)</code>). In the calling code any number of parameters of that type can be used and they are then placed in an array to be passed to the method, or alternatively the calling code can pass an array of that type.
* Enhanced <code>for</code> [[program loop|loop]] &mdash; the <code>for</code> loop syntax is extended with special syntax for iterating over each member of either an array or any {{Javadoc:SE|java/lang|Iterable}}, such as the standard {{Javadoc:SE|java/util|Collection}} classes, using a construct of the form: