FAQ
If you use the FindBugs plugin (Eclipse -- can run manually, too),
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.
On Dec 20, 2007, at 1:47 AM, Aristedes Maniatis wrote:

On 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" 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:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
groupdev @
categoriescayenne
postedDec 30, '07 at 3:16p
activeDec 30, '07 at 3:16p
posts1
users1
websitecayenne.apache.org

1 user in discussion

Michael Gentry: 1 post

People

Translate

site design / logo © 2022 Grokbase