Here you can find the source of selectElements(final List
public static List<String> selectElements(final List<String> list, int start, int end)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { public static List<String> selectElements(final List<String> list, int start, int end) { // Generated a new list out of elements that lies within [start,end] // limit. if (list.size() == 0 || !(0 <= start && end < list.size())) return null; final List<String> newList = new ArrayList<String>(); for (int index = start; index <= end; index++) newList.add(String.valueOf(list.get(index))); return newList; }//from w w w . ja v a 2 s .co m }