int used by Java for most of all calculations. Integer used in all forms of collections except primitive arrays.
The use of a large number of temporary integers with a thrash garbage collector and the use of an unproductive processor in the background, which will cause a general slowdown in everything. Too many temporary downloads per second will cause the CG to go into the โI need memory nowโ emergency mode, which can lead to delays in mission-critical applications (for example, real-time interactive graphics, physical device controllers, or communications).
So for me, if I have a lot of nested calls that do not do math but have access to many collections, such as using keys for cards, I use Integer to avoid tons of automatic boxing when passing arguments.
If operations are intensive in mathematics or are used as cycle counters or other mathematical operations and are not stored in collections (except for primitive arrays), I use a primitive. The same applies to all other primitives except String, which is a full-fledged object.
peterk Oct 17 '15 at 17:43 2015-10-17 17:43
source share