Here you can find the source of filterByIndices(List
static public <E> List<E> filterByIndices(List<E> list, BitSet filter)
//package com.java2s; /*/*w w w . j av a 2s .c om*/ * Copyright (c) 2015 Villu Ruusmann * * This file is part of JPMML-Converter * * JPMML-Converter is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * JPMML-Converter is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with JPMML-Converter. If not, see <http://www.gnu.org/licenses/>. */ import java.util.ArrayList; import java.util.BitSet; import java.util.List; public class Main { static public <E> List<E> filterByIndices(List<E> list, BitSet filter) { List<E> result = new ArrayList<>(list.size()); for (int i = 0; i < list.size(); i++) { E element = list.get(i); if (filter.get(i)) { result.add(element); } } return result; } }