It is called AutoBoxing
Autoboxing and Auto-Unboxing of
Primitive Types Converting between
primitive types, like int, boolean,
and their equivalent Object-based
counterparts like Integer and Boolean,
can require unnecessary amounts of
extra coding, especially if the
conversion is only needed for a method
call to the Collections API, for
example.
The autoboxing and auto-unboxing of
Java primitives produces code that is
more concise and easier to follow. In
the next example an int is being
stored and then retrieved from an
ArrayList. The 5.0 version leaves the
conversion required to transition to
an Integer and back to the compiler.
Before
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(0, new Integer(42));
int total = (list.get(0)).intValue();
After
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(0, 42);
int total = list.get(0);