Java List Select selectElements(final List list, int start, int end)

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

Description

select Elements

License

Open Source License

Declaration

public static List<String> selectElements(final List<String> list, int start, int end) 

Method Source Code

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

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static List<String> selectElements(final List<String> list, int start, int end) {
        // Generated a new list out of elements that lies within [start,end]
        // limit.
        if (list.size() == 0 || !(0 <= start && end < list.size()))
            return null;
        final List<String> newList = new ArrayList<String>();
        for (int index = start; index <= end; index++)
            newList.add(String.valueOf(list.get(index)));
        return newList;
    }//from   w  w w . ja  v  a 2 s .co m
}

Related

  1. select(List list, List indices, List sel)
  2. select(List src, List indexes)
  3. selectDuplicateQualifiers( List elements)
  4. selectExactly(List original, int nb)
  5. selectFields(String[] fields, List fieldList, int allFieldsFrom, String separator)
  6. selectRandom(List list)
  7. selectTopN(List originalList, int topN, Comparator comparator)

    HOME | Copyright © www.java2s.com 2016