Here you can find the source of split(List
public static final <T extends Object> List<List<T>> split(List<T> list, int size)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { /**// w ww .j a v a 2s . c om * Splits a List into a list of smaller lists within the maximum size. */ public static final <T extends Object> List<List<T>> split(List<T> list, int size) { if (size == 0) { throw new IllegalArgumentException("List size must be > 0"); } List<List<T>> lists = new ArrayList<List<T>>(); for (int i = 0; i < list.size(); i += size) { lists.add(list.subList(i, Math.min(i + size, list.size()))); } return lists; } }