I have a list of pojos. To convert this pojos list to a List, where each sublist is 10 or less in size. So, for example, List of size 13 is converted to a list of two elements. The first element is a list of 10 elements, the second is an element of list 3.
So the data structure is List<List<pojo>>
To create this list of lists:
List<List<pojo>> pojoList counter = 0; initialise new tempList iterate list add current pojo to temp list if counter = 10 then add tempList to pojoList reset counter and tempList and continue until list is iterated
Is there an alternative solution?
blue-sky
source share