//待处理的List List handlerList; //分批处理,每次处理100个 int limit = 100; List<String> newList = new ArrayList<>(); for(int i=0; i < handlerList.size(); i++){ newList.add(handlerList.get(i)); if(limit == newList.size() || i == handlerList.size()-1){ //处理业务newList //…… //清空newList,处理下一批 newList.clear(); } }
Java分批处理List集合
最新推荐文章于 2023-10-24 10:45:23 发布