Here you can find the source of split(final List
public static <T> List<List<T>> split(final List<T> orginalList, final int splitSize)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { public static <T> List<List<T>> split(final List<T> orginalList, final int splitSize) { int startIndex = 0; int endIndex = splitSize; List<List<T>> lists = new ArrayList<List<T>>(); for (int i = 1;;) { if (endIndex <= orginalList.size()) { lists.add(orginalList.subList(startIndex, endIndex)); startIndex = endIndex;// ww w . j av a2 s .c o m ++i; endIndex = i * splitSize; } else if (startIndex < orginalList.size()) { lists.add(orginalList.subList(startIndex, orginalList.size())); break; } else break; } return lists; } }