Here you can find the source of subList(List
Parameter | Description |
---|---|
list | the list |
start | the start index |
end | the end index |
public static <X> List<X> subList(List<X> list, int start, int end)
//package com.java2s; /**// w w w .j a v a 2 s . c om * Sencha GXT 3.0.1 - Sencha for GWT * Copyright(c) 2007-2012, Sencha, Inc. * licensing@sencha.com * * http://www.sencha.com/products/gxt/license/ */ import java.util.ArrayList; import java.util.List; public class Main { /** * Returns a section of the given list. * * @param list the list * @param start the start index * @param end the end index * @return the sub list */ public static <X> List<X> subList(List<X> list, int start, int end) { List<X> temp = new ArrayList<X>(); for (int i = start; i < end; i++) { temp.add(list.get(i)); } return temp; } }