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);
}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM