Here you can find the source of subListByStartAndEnd( List
public static <M extends Comparable> List<M> subListByStartAndEnd( List<M> list, M start, M end)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { public static <M extends Comparable> List<M> subListByStartAndEnd( List<M> list, M start, M end) { List<M> returnList = new ArrayList<M>(); for (M element : list) { if (element.compareTo(start) >= 0 && element.compareTo(end) <= 0) { returnList.add(element); }// ww w . ja v a 2 s . co m } return returnList; } }