Java List Sub List subList(List list, int start, int end)

Here you can find the source of subList(List list, int start, int end)

Description

sub List

License

Open Source License

Declaration

public static <T> List<T> subList(List<T> list, int start, int end) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    public static <T> List<T> subList(List<T> list, int start, int end) {
        List<T> subList = new ArrayList<>();
        for (int i = start; i < end; i++) {
            if (list.size() > i) {
                subList.add(list.get(i));
            } else {
                break;
            }/*from   w  w w.j  a v a 2 s  .c  o m*/
        }
        return subList;
    }
}

Related

  1. subList(List it, int offset, int limit)
  2. sublist(List l, int fromIndex, int toIndex)
  3. subList(List list, int fromIndex, int toIndex)
  4. subList(List list, int fromIndex, int toIndex)
  5. subList(List list, int size)
  6. sublist(List list, int start, int limit)
  7. subList(List list, int start, int max)
  8. subList(List list, int[] indexs)
  9. subList(List origin, int start, int length)