Package io.vavr

Class API.ForLazy2Try<T1,​T2>

  • Type Parameters:
    T1 - the component type of the 1st Try
    T2 - the component type of the 2nd Try
    Enclosing class:
    API

    public static class API.ForLazy2Try<T1,​T2>
    extends java.lang.Object
    A lazily evaluated For-comprehension with two Trys.

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

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <R> Try<R> yield​(@NonNull java.util.function.BiFunction<? super T1,​? super T2,​? extends R> f)
      Produces results by mapping the Cartesian product of all bound values.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • yield

        public <R> Try<R> yield​(@NonNull java.util.function.BiFunction<? super T1,​? super T2,​? extends R> f)
        Produces results by mapping the Cartesian product of all bound values.

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

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