Uses of Interface
io.reacted.patterns.Try.TryMapper

  • Uses of Try.TryMapper in io.reacted.patterns

    Methods in io.reacted.patterns with parameters of type Try.TryMapper 
    Modifier and Type Method Description
    <U> Try<U> Try.flatMap​(Try.TryMapper<? super T,​Try<? extends U>> flatMapper)
    Like Stream.flatMap(), Try.flatMap flattens two nested Try.
    <U> Try<U> Try.map​(Try.TryMapper<? super T,​? extends U> mapper)
    If the Try is successful, another Try will be returned with the result of the specified mapper, otherwise the current Try is returned
    <U> Try<U> Try.mapOrElse​(Try.TryMapper<? super T,​? extends U> ifSuccess, Try.TryMapper<? super java.lang.Throwable,​? extends U> orElse)
    A functional if then else: if the Try is successful the ifSuccess mapper is used, otherwise the throwable mapper.
    Try<T> Try.orElseTry​(Try.TryMapper<java.lang.Throwable,​Try<? extends T>> excToAlternative)
    Gets the current Try or if it is a failure maps the generated exception into an alternative Try using the specified mapper
    <X extends java.lang.Throwable>
    Try<T>
    Try.recover​(java.lang.Class<X> exception, Try.TryMapper<? super java.lang.Throwable,​? extends T> alternativeMapper)
    Recover the status of a Try, if failed, mapping the generated exception to another org .reacted.patterns.Try Will be returned the original Try if it is successful, otherwise the try returned by the mapper Different recover calls can be chains for fine exception handling
    static <T,​ A extends java.lang.AutoCloseable,​ A1 extends java.lang.AutoCloseable>
    Try<T>
    Try.withChainedResources​(Try.TryResourceSupplier<? extends A> resourceSupplier1, Try.TryMapper<A,​? extends A1> resourceMapper, UnChecked.CheckedBiFunction<? super A,​? super A1,​? extends T> resourceToResult)  
    static <T,​ A extends java.lang.AutoCloseable>
    Try<T>
    Try.withResources​(Try.TryResourceSupplier<? extends A> resourceSupplier, Try.TryMapper<? super A,​? extends T> resourceToResult)
    Applies a consumer on a resource.