com.github.scr.j8iterables.core.SupplierIterable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of j8iterables Show documentation
Show all versions of j8iterables Show documentation
Extension of Guava Iterables using Java 8 Collections and Streams
package com.github.scr.j8iterables.core;
import com.google.common.collect.FluentIterable;
import java.util.Iterator;
import java.util.function.Supplier;
/**
* Iterable that gets its {@link Iterator} from a {@link Supplier}.
*
* @author scr
*/
public class SupplierIterable extends FluentIterable {
private final Supplier> SUPPLIER;
public SupplierIterable(Supplier> supplier) {
SUPPLIER = supplier;
}
@Override
public Iterator iterator() {
return SUPPLIER.get();
}
}