java - Performance implications of autoboxing on ArrayList of primitive wrappers -


java not let create arraylist of primitives directly. can create arraylist of primitives wrapper class.

but when accessing primitive value , compiler automatically wrapping , unwrapping. not overhead ? question performance implications of ?

in such case wouldn't int[] perform better arraylist<integer> ?

has measured performance of int[] vs arraylist<inetger> java5.0 (when first introduced) , latter versions of java. helpful runs question , if share test results.

indeed adds overhead. if problem you, consider using library supporting collections of primitives out of box. example trove, guava or google library


Comments