/** * 把list集合里的内容按照len大小分组 * @param list * @param len * @return */ private static List<List<String>> splitList(List<String> list, int len) { if (list == null || list.size() == 0 || len < 1) { return null; } List<List<String>> result = new ArrayList<List<String>>(); int size = list.size(); int count = (size + len - 1) / len; for (int i = 0; i < count; i++) { List<String> subList = list.subList(i * len, ((i + 1) * len > size ? size : len * (i + 1))); result.add(subList); } return result; }