Here you can find the source of subList(List
public static <T> List<T>[] subList(List<T> src, int preBatchCount)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static <T> List<T>[] subList(List<T> src, int preBatchCount) { int count = src.size(); int batchCount = (count + preBatchCount - 1) / preBatchCount; List[] result = new List[batchCount]; for (int index = 0; index < batchCount; ++index) { int begin = index * preBatchCount; int end = (index + 1) * preBatchCount; if (end > count) { end = count;//from w w w . jav a 2s.c o m } result[index] = src.subList(begin, end); } return result; } }