Java List Sub List subListByStartAndEnd( List list, M start, M end)

Here you can find the source of subListByStartAndEnd( List list, M start, M end)

Description

sub List By Start And End

License

Apache License

Declaration

public static <M extends Comparable> List<M> subListByStartAndEnd(
            List<M> list, M start, M end) 

Method Source Code

//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;
    }
}

Related

  1. subList(List origin, int start, int length)
  2. subList(List parentList, int start, int end)
  3. subList(List query, int first, int max)
  4. subList(List src, int preBatchCount)
  5. subList(List list, int start, int end)
  6. subListMaxSize(List list, int maxSize)
  7. subListPage(List baseList, int fromIndex, int maxPageSize)
  8. truncatedSubList(List inList, int start, int end)