Java list分割批量处理

private final static int INIT = 300;
int size = update.size();
int temptStart, temptEnd;
List<AssetsInfo> result;
for (int i = 0; ; i++) {
temptStart = i * INIT;
temptEnd = temptStart + INIT;
if(temptEnd > size){
result = update.subList(temptStart, size);
assetsInfoService.updateOrgRelatBathById(result);
break;
}
result = update.subList(temptStart, temptEnd);
assetsInfoService.updateOrgRelatBathById(result);
}

 

posted @ 2021-02-05 15:16  稻火  阅读(697)  评论(0编辑  收藏  举报