boxing: new Integer(i)

Developers
2013-11-25
2013-11-25
  • Guus Bonnema
    Guus Bonnema
    2013-11-25

    Hi Paul,

    I often get a warning from findbug for a method call with integer parameters, that in stead of boxing an int (see title), it is better to either use the int (will be cast or autoboxed if necessary) or, sometimes do Integer.valueOf(..)

    For Instance when using i/2 use the Integer.valueOf(i/2) version.

    Just thought I would let you know, unnecessary boxing is a performance loss.

    Regards, Guus.