Java List Sub List getSubList(List source, int nFrom, int nTo)

Here you can find the source of getSubList(List source, int nFrom, int nTo)

Description

get Sub List

License

Open Source License

Declaration

public static List getSubList(List source, int nFrom, int nTo) 
    

Method Source Code


//package com.java2s;
import java.util.*;

public class Main {
    public static List getSubList(List source, int nFrom, int nTo) // INCLUSIVE
    {/*ww w  .  j  ava2 s  .c  om*/
        if (nFrom < 0) // $$$$ HACK
            nFrom = 0;

        List list = new ArrayList();
        for (int i = nFrom; i < (nTo + 1); ++i) {
            list.add(source.get(i));
        }
        return list;
    }
}

Related

  1. getIndicesOfItems(List superList, List sublist)
  2. getRandomSubList(List inputList, double percentage)
  3. getSubList(int offset, int count, List originalList)
  4. getSubList(List entireList, Class cls)
  5. getSubList(List list, Class type)
  6. getSubList(List allKeys, String part)
  7. getSubList(List list, int from, int maxnum)
  8. getSublist(List list, int i)
  9. getSubList(List list, int start, int end)