Java List Sub List subList(List lst, Collection indices)

Here you can find the source of subList(List lst, Collection indices)

Description

Create a sub list with just these indices

License

Open Source License

Declaration

public static <T1> List<T1> subList(List<T1> lst, Collection<Integer> indices) 

Method Source Code


//package com.java2s;

import java.util.*;

public class Main {
    /**/* ww  w.  j  a  v a2s  . co  m*/
     * Create a sub list with just these indices
     */
    public static <T1> List<T1> subList(List<T1> lst, Collection<Integer> indices) {
        List<T1> sublst = new ArrayList<>();
        for (Integer idx : indices)
            sublst.add(lst.get(idx));
        return sublst;
    }
}

Related

  1. subList(List list, int page, int size)
  2. subList(List list, int fromIndex)
  3. subList(List list, int skip, int top)
  4. subList(List list, int start, int end)
  5. subList(List list, int begin, int end)
  6. subList(List initial, int threshold)
  7. subList(List input, int startIndex, int count)
  8. subList(List input, int startIndex, int count)
  9. subList(List it, int offset, int limit)