Hello.
(sorry if this show up several times. looks like I have some unstable
mail today..)
On Dec 20, 2007, at 10:47 , Aristedes Maniatis wrote:
> On 20/12/2007, at 8:44 PM, torehalse..pache.org wrote:
>
>> java 5: new Integer(int) -> Integer.valueOf(int)
>
> Or we could start to use autoboxing and just use "int" where
> appropriate. Is valueOf recommended over new Integer() for speed or
> other reasons in Java 5?
I am currently -1 to autoboxing, but Integer.valueOf(int) should not
be a problem for anyone.
From javadoc:
"Returns a Integer instance representing the specified int value. If a
new Integer instance is not required, this method should generally be
used in preference to the constructor Integer(int), as this method is
likely to yield significantly better space and time performance by
caching frequently requested values."
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Integer.html#valueOf(int)
Regards,
- Tore.
This archive was generated by hypermail 2.0.0 : Thu Dec 20 2007 - 07:07:20 EST