List dataList = new ArrayList(); for(int i=0;i<999;i++) dataList.add(4); int splitSize = 500; int arryLength = dataList.size(); int result = 0; int group = 0; if (arryLength % splitSize != 0) { group = 1; } result = arryLength / splitSize; result += group; logger.info("一共" + arryLength + "批数据"); for (int i = 0; i < result; i++) { List listItem = new ArrayList(splitSize); if (i == result - 1) { listItem = dataList.subList(i * splitSize, arryLength); } else { listItem = dataList.subList(i * splitSize, (i + 1) * splitSize); } logger.info("第" + (i + 1) + "组批量操作成功,成功数据item:" + listItem.size()); }