Package io.vavr

Class API.ForLazy4Validation<L,​T1,​T2,​T3,​T4>

  • Type Parameters:
    L - the common left-hand type of all Validations
    T1 - the component type of the 1st Validation
    T2 - the component type of the 2nd Validation
    T3 - the component type of the 3rd Validation
    T4 - the component type of the 4th Validation
    Enclosing class:
    API

    public static class API.ForLazy4Validation<L,​T1,​T2,​T3,​T4>
    extends java.lang.Object
    A lazily evaluated For-comprehension with 4 Validations.

    Constructed via For(...) and evaluated by calling yield(...). Construction is side-effect free; underlying Validations are traversed only when yield(...) is invoked.

    • Method Detail

      • yield

        public <R> Validation<L,​R> yield​(@NonNull Function4<? super T1,​? super T2,​? super T3,​? super T4,​? extends R> f)
        Produces results by mapping the Cartesian product of all bound values.

        Evaluation is lazy and delegated to the underlying Validations by composing flatMap and map chains.

        Type Parameters:
        R - the element type of the resulting Validation
        Parameters:
        f - a function mapping a tuple of bound values to a result
        Returns:
        an Validation containing mapped results
        Throws:
        java.lang.NullPointerException - if f is null