O
Oliver Wong
As we all know, it's preferable to use Integer.valueOf(42) over new
Integer(42), as the former uses a cache to avoid unnescessary object
creation. So it seems strange to me that the Integer.valueOf("42") will
create a new object every time (I'm looking at version 1.92, 04/07/06 of the
class file).
Is there a legitimate reason for this, or might this be something to
submit as a Request For Enhancement to Sun?
- Oliver
Integer(42), as the former uses a cache to avoid unnescessary object
creation. So it seems strange to me that the Integer.valueOf("42") will
create a new object every time (I'm looking at version 1.92, 04/07/06 of the
class file).
Is there a legitimate reason for this, or might this be something to
submit as a Request For Enhancement to Sun?
- Oliver