Is there anyway to split ArrayList into different parts without knowing size of it until runtime? I know there is a method called:
list.subList(a,b);
This should give you all your parts :
int partitionSize = 1000; List> partitions = new LinkedList>(); for (int i = 0; i < originalList.size(); i += partitionSize) { partitions.add(originalList.subList(i, Math.min(i + partitionSize, originalList.size()))); }