Here you can find the source of subList(List
public static <T1> List<T1> subList(List<T1> lst, Collection<Integer> indices)
//package com.java2s; import java.util.*; public class Main { /**/* ww w. j a v a2s . co m*/ * Create a sub list with just these indices */ public static <T1> List<T1> subList(List<T1> lst, Collection<Integer> indices) { List<T1> sublst = new ArrayList<>(); for (Integer idx : indices) sublst.add(lst.get(idx)); return sublst; } }