How to convert an ArrayList containing Integers to primitive int array?
You can convert, but I don’t think there’s anything built in to do it automatically: (Note that this will throw a NullPointerException if either integers or any element within it is null.) EDIT: As per comments, you may want to use the list iterator to avoid nasty costs with lists such as LinkedList: