com.softicar.platform.common.container.filter.FilteringIterable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of platform-common Show documentation
Show all versions of platform-common Show documentation
The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.
package com.softicar.platform.common.container.filter;
import java.util.Iterator;
import java.util.function.Predicate;
/**
* An {@link Iterable} that filters elements of another {@link Iterable}.
*
* @author Oliver Richers
*/
public class FilteringIterable implements Iterable {
private final Iterable iterable;
private final Predicate predicate;
public FilteringIterable(Iterable iterable, Predicate predicate) {
this.iterable = iterable;
this.predicate = predicate;
}
@Override
public Iterator iterator() {
return new FilteringIterator<>(iterable.iterator(), predicate);
}
}