I know that:
When choosing between a one-dimensional array and an arraist, arraialists should always be the preferred choice with one major exception; when collecting primitive values and efficiency. Since ArrayList uses internal arrays, high performance (in terms of processing time and memory size) is similar to arrays when performing operations on object types. However, ArrayList performance suffers when dealing with primitive types such as int or long, since ArrayList requires all elements to be wrapped in Object (for example, Integer or Long). While autoboxing reduces the amount of code needed for packaging and deployment, it does not eliminate performance issues because wrapper objects are still being created.
But I am looking for a real example where I collected primitive values, and efficiency is a problem. Can you think about it?
source
share