Here you can find the source of getSubList(List
public static <T> List<T> getSubList(List<T> list, int start, int limit)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { public static <T> List<T> getSubList(List<T> list, int start, int limit) { if (list == null || list.isEmpty()) { return new ArrayList<T>(0); }/*w ww. j ava 2 s .c o m*/ int listLength = list.size(); if (start > listLength - 1) { return new ArrayList<T>(); } limit = start + limit > listLength ? listLength - start : limit; return list.subList(start, start + limit); } }