class StreamUtils {

    public static <T> Stream<T> unfold(T seed, Function<T, Optional<T>> generator) {
        return StreamSupport.stream(new UnfoldSpliterator(seed, generator), !PARALLEL);
    }

}