Package ai.libs.jaicore.basic.sets
Class FilteredIterable<X>
- java.lang.Object
-
- ai.libs.jaicore.basic.sets.FilteredIterable<X>
-
- Type Parameters:
X- The type of elements to iterate over.
- All Implemented Interfaces:
java.lang.Iterable<X>
public class FilteredIterable<X> extends java.lang.Object implements java.lang.Iterable<X>This class allows to iterate of any type ofIterablein a filtered way. More specifically, given a whitelist of indices, this class allows to iterate only over the elements listed in that whitelist. This util works for all kind ofIterables. The basic idea is to avoid copying data for iterating over subsets only. Note that this does only work for iterables with a fixed order, i.e., no HashSets!
-
-
Constructor Summary
Constructors Constructor Description FilteredIterable(java.lang.Iterable<X> wrappedIterable, java.util.List<java.lang.Integer> filteredIndices)Standard c'tor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.Integer>getFilteredIndices()Getter for the list of filtered indices.java.util.Iterator<X>iterator()
-
-
-
Constructor Detail
-
FilteredIterable
public FilteredIterable(java.lang.Iterable<X> wrappedIterable, java.util.List<java.lang.Integer> filteredIndices)
Standard c'tor.- Parameters:
wrappedIterable- The iterable which is to be wrapped and filtered.filteredIndices- The list of indices that are whitelisted and are expected to be returned when iterating over the iterable.
-
-