JDK 1.5 features
-
autoboxing / autounboxing
-
generics
-
for-each loop
-
vararg (Variable-Length Arguments)
-
emun (Enumerations)
-
annotations
getClass().getAnnotation() -
static import
import static java.lang.Math.*; -
c-lang printf()
new Formatter().format("dec: %d, hexa: %x, char: %c, doub: %1.4f.", 50, 50, 'A', 3.14).toString(); -
Scanner
new Scanner("10 5 3 1") .nextInt()/.hasNextInt() -
collections (generics)
new ArrayList<Integer>(); new PriorityQueue<Double>() -
high-performance immutable StringBuilder (replacement of mutable StringBuffer)
JDK 1.4 features
-
assert operator
java -ea AssertPractice -
regular expressions
Pattern.compile(matchObj).matcher(origObj).group()/start()/end() -
splitting
"a String".split(" "); -
exception chaining / wrapping
links: