I have an ArrayList, which I want to divide into smaller Lists of n size, and perform an operation on each. My current method of doing this is
implemented with Array
If you are working with a list I use the "Apache Commons Collections 4" library. It has a partition method in the ListUtils class:
...
int targetSize = 100;
List largeList = ...
List> output = ListUtils.partition(largeList, targetSize);
This method is adapted from http://code.google.com/p/guava-libraries/