I came across a class using Integer variables to capture size to be used in a for loop. Is this good practice or should we use the int primitive data type?
I
I normally use Integer because of purely OO. Performance of int is definitely far better than its object counterpart but it is noticeable only when you are looping millions time in the loop.
IMHO, If performance is paramount importance in you application and you want to squeeze even single nano second then use int without any brain. But if OO and readability is main concerned then use Integer.