分批处理数据,一次100

wylc123 2月前 ⋅ 113 阅读
public static void main(String[] args) {
        int[] data = new int[]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23};
        Integer[] integers1 = Arrays.stream(data).boxed().toArray(Integer[]::new);
        List<Integer> wordList = Arrays.asList(integers1);
        for (int i = 0; i < wordList.size(); i = i + 10) {
            if(i+10<wordList.size()){
                List<Integer> lwDataList = wordList.subList(i,i+10);
                System.out.println(JSON.toJSONString(lwDataList));
            }else {
                List<Integer> lwDataList = wordList.subList(i,wordList.size());
                System.out.println(JSON.toJSONString(lwDataList));
            }
        }
;    }

相关文章推荐
  • 该目录下还没有内容!

全部评论: 0

    我有话说: