Here you can find the source of split(Collection extends T> d, int n)
public static <T> Collection<? extends T> split(Collection<? extends T> d, int n)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; public class Main { public static <T> Collection<? extends T> split(Collection<? extends T> d, int n) { Collection<T> tmp = new ArrayList<>(); Iterator it = d.iterator(); int k = Math.max(0, n); while (it.hasNext() && k > 0) { tmp.add((T) it.next());/*from w ww . j a va 2 s . c om*/ k--; } return tmp; } }