list分段截取

public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        getUserIdsPage("3", 0L, list);
        System.err.println("一共有===>" + list.size());
        int toIndex = 50;
        for (int i = 0; i < list.size(); i += 50) {
            if (i + 50 > list.size()) {
                toIndex = list.size() - i;
            }
            List<String> list1 = list.subList(i, i + toIndex);
            System.err.println("子集合一共有===>" + list1.size() + " , i==== " + i);
        }
    }

你可能感兴趣的:(Java)