Yes, it will require auto-unboxing and auto-boxing for each iteration. It'll work the same way, and you don't need to do anything to make it work, but it's unnecessary and easily avoided.
Also it might slightly slow down the loop for no real advantage.
Basically Integer
should only ever be used when you actually need the number to be an Object
(for example when you put it into a collection, when null
is a valid value, ...). At all other times, you should use the primitive types where possible (int
, char
, ...).