Here you can find the source of split(List
public static <T> List<List<T>> split(List<T> list, int size)
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { public static <T> List<List<T>> split(List<T> list, int size) { List<List<T>> lists = new ArrayList<List<T>>(); int count = (list.size() / size) + (list.size() % size == 0 ? 0 : 1); for (int i = 0; i < count; i++) { int fromIndex = i * size, toIndex = (i + 1) * size; List<T> subList = list.subList(fromIndex, toIndex > list.size() ? list.size() : toIndex); lists.add(subList);/* w ww .j a v a 2s . c o m*/ } return lists; } }