Java tutorial
//package com.java2s; //it under the terms of the GNU Affero General Public License as published by import java.util.ArrayList; import java.util.List; public class Main { public static <T> List<T> indexedSelection(List<T> in, int... indices) { ArrayList<T> res = new ArrayList<T>(); for (int i : indices) res.add(in.get(i)); return res; } }