uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Lally" <ala...@alum.rpi.edu>
Subject Re: New Java 1.5 construct to use
Date Tue, 04 Dec 2007 23:21:45 GMT
On Dec 4, 2007 4:27 PM, Marshall Schor <msa@schor.com> wrote:
> In many places in our code we "box" ints using new Integer(anInt).
>
> Java 5, I discovered via some "findbugs" runs, now has a new static
> method in the Integer class, with a signature of
> Integer.valueOf(anInt)
>
> This is equivalent to the new Integer(...) construct, except that the
> JVM caches these values, and reuses an existing value, thus
> (potentially) reducing both space and time.
>

Or you can just do direct assignment now.
Integer anInteger = anInt;

> Unless the code needs unique Integers (for instance, if it is using
> these for wait/notify locks)

Hopefully none of our developers would do anything so silly. :)

-Adam

Mime
View raw message