Java List Sub List getSubListFromStart(List list, int length)

Here you can find the source of getSubListFromStart(List list, int length)

Description

get Sub List From Start

License

Open Source License

Declaration

public final static <T> List<T> getSubListFromStart(List<T> list, int length) 

Method Source Code


//package com.java2s;

import java.util.List;

public class Main {

    public final static <T> List<T> getSubListFromStart(List<T> list, int length) {

        List<T> listSub = null;
        if (list != null) {
            length = list.size() > length ? length : list.size();
            listSub = list.subList(0, length);
        }/* ww  w .ja va  2 s  .  co m*/
        return listSub;
    }
}

Related

  1. getSubList(List allKeys, String part)
  2. getSubList(List list, int from, int maxnum)
  3. getSublist(List list, int i)
  4. getSubList(List list, int start, int end)
  5. getSubList(List list, int start, int limit)
  6. getSubListIndex(Object[] tofind, Object[] tokens)
  7. isSubList(List l1, List l)
  8. lastIndexOfSubList(final List list0, final List list1)
  9. slice(List stringList, int subListSize)