I have a List of size 30K and I split them into chunks of 1000 as I need to use the ids from the sublist to get rest endpoint and do some assertions. I am using jersey client to talk to rest endpoints
ArrayList<String> ga1 = new ArrayList<>(Ids.subList(1,1000));
ArrayList<String> ga2 = new ArrayList<>(Ids.subList(1001,2000));
ArrayList<String> ga3 = new ArrayList<>(Ids.subList(2001,3000));
ArrayList<String> ga4 = new ArrayList<>(Ids.subList(3001,4000));
...
ArrayList<String> ga30 = new ArrayList<>(Ids.subList(29001,sizeOfTheOriginalList));
checkSubList(ga1);
{
Assertions;
}
checkSubList(ga30);
{
Assertions;
}
Is there a better way to split the original list and get the sublist
>? Avoid ignoring the first element or every chunk, while you're at it.
– JB Nizet Oct 20 '19 at 09:13