Here you can find the source of split(List
static <T> List<List<T>> split(List<T> list, final int parts)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { static <T> List<List<T>> split(List<T> list, final int parts) { List<List<T>> subLists = new ArrayList<>(parts); for (int i = 0; i < parts; i++) { subLists.add(new ArrayList<T>()); }//from w ww . j a v a 2s. c om for (int i = 0; i < list.size(); i++) { subLists.get(i % parts).add(list.get(i)); } return subLists; } }