私はポジョのリストを持っています。この pojo のリストを、各サブリストのサイズが 10 以下のリストのリストに変換するには。たとえば、サイズ 13 の List は 2 つの要素を持つ List に変換されます。最初の要素は 10 項目のリストで、2 番目の要素は 3 つの項目のリストです。
したがって、データ構造はList<List<pojo>>
このリストのリストを作成するには:
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
代替ソリューションはありますか?