Here you can find the source of split(List
static <T> List<List<T>> split(List<T> list) throws Exception
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { static <T> List<List<T>> split(List<T> list) throws Exception { if (list.size() < 2) { throw new Exception("Not splittable list"); }//from w ww .j av a 2 s . co m int halfSize = list.size() % 2 == 0 ? list.size() / 2 : list.size() / 2 + 1; return chopped(list, halfSize); } static <T> List<List<T>> chopped(List<T> list, final int L) { List<List<T>> parts = new ArrayList<List<T>>(); final int N = list.size(); for (int i = 0; i < N; i += L) { parts.add(new ArrayList<T>(list.subList(i, Math.min(N, i + L)))); } return parts; } }