Interface LazyFunction<T>


  • public interface LazyFunction<T>
    A lazy function is used to populate a Flow incrementally. Lazy functions allow calculations to be deferred. They also support infinitely large Flows, where successive values are computed just as needed.
    Since:
    5.2.0
    • Method Detail

      • next

        LazyContinuation<Tnext()
        Calculates the next value for the function. The return value is tricky: it combines the next value in the Flow with a function to compute the value after that as a LazyContinuation. Alternately, a LazyFunction can return null to indicate that it has returned all the values it can.
        Returns:
        continuation containing next value and next function, or null when no more values can be produced