Here you can find the source of getAll_SequentialAccess( List
public static <V> LinkedList<V> getAll_SequentialAccess( List<Integer> idxs, List<V> values)
//package com.java2s; //License from project: LGPL import java.util.LinkedList; import java.util.List; import java.util.ListIterator; public class Main { /**// www . ja va 2s . c o m * Takes all values specified by the given <tt>idxs</tt> (which must be in ascending order) * from <tt>values</tt> through the use of a ListIterator. */ public static <V> LinkedList<V> getAll_SequentialAccess( List<Integer> idxs, List<V> values) { LinkedList<V> taken = new LinkedList<V>(); ListIterator<V> valueIter = values.listIterator(); int valuesIdx = -1; V value = null; int lastIdx = -1; for (int idx : idxs) { assert idx >= lastIdx; lastIdx = idx; // ensure that the index list is sorted while (valuesIdx < idx) { value = valueIter.next(); valuesIdx++; } taken.add(value); } return taken; } }