Looking at the following class I\'ve made:
public class FibonacciSupplier implements Iterator {
private final IntPredicate hasNextPredicat
You can use the low level stream support primitives and the Spliterators library to make a stream out of an Iterator.
The last parameter to StreamSupport.stream() says that the stream is not parallel. Be sure to let it like that because your Fibonacci iterator depends on previous iterations.
return StreamSupport.stream( Spliterators.spliteratorUnknownSize( new Iterator()
{
@Override
public boolean hasNext()
{
// to implement
return ...;
}
@Override
public ContentVersion next()
{
// to implement
return ...;
}
}, Spliterator.ORDERED ), false );