it'll flag all of those "new Integer()" calls, too. It is a
worthwhile plugin/tool.
/dev/mrg
On Dec 29, 2007 5:30 PM, Craig L Russell wrote:
I didn't see a reply to this one.
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
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!
I didn't see a reply to this one.
On Dec 20, 2007, at 1:47 AM, Aristedes Maniatis wrote:
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 thatOn 20/12/2007, at 8:44 PM, torehalset@apache.org wrote:
java 5: new Integer(int) -> Integer.valueOf(int)
Or we could start to use autoboxing and just use "int" wherejava 5: new Integer(int) -> Integer.valueOf(int)
appropriate. Is valueOf recommended over new Integer() for speed or
other reasons in Java 5?
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-------------------------->
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
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!