Java tutorial
//package com.java2s; import java.util.List; import java.util.Vector; public class Main { /** * * @param <T> * @param list * @param fromIndex * @param toIndex * @return */ public static <T> List<T> subList(List<T> list, int fromIndex, int toIndex) { List<T> subList = new Vector<T>(toIndex - fromIndex); for (int i = Math.max(0, fromIndex); ((i < toIndex) && (i < list.size())); i++) { T obj = list.get(i); subList.add(obj); } return subList; } }