I didn't see a reply to this one.

On Dec 20, 2007, at 1:47 AM, Aristedes Maniatis wrote:


On 20/12/2007, at 8:44 PM, [EMAIL PROTECTED] 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?

Yes, it's recommended. The valueOf method returns an instance that might already be lying around whereas new Integer will always create an object that will have to be garbage collected later. So valueOf is preferable if the code will always be run in a Java 5 or better vm.

Craig

Ari



-------------------------->
Aristedes Maniatis
phone +61 2 9660 9700
PGP fingerprint 08 57 20 4B 80 69 59 E2  A9 BF 2D 48 C2 20 0C C8



Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to