❤️java集合分批处理集合数据

小明的学习圈子2023-10-07集合集合 批量更新

java集合分批处理集合数据

	public void test() {
		List<User> list = userMapper.getPersionList();
	
		if (null != list && list.size() > 0) {
			int BATCH_SIZE = 500;
	        for (int i = 0; i < list.size(); i += BATCH_SIZE) {
	            int start = i;
	            int end = Math.min(start + BATCH_SIZE, list.size());
	            List<User> dataBatch = list.subList(start, end);
                //调用接口或者方法
	            newReportBatch(dataBatch);
	           
	        }
	  
		}

	}
Last Updated 2024/4/6 11:55:17