Class Try.Success<T>

java.lang.Object
com.github.skopylov58.functional.Try.Success<T>
Type Parameters:
T - result type
All Implemented Interfaces:
Try<T>, AutoCloseable
Enclosing interface:
Try<T>

public static class Try.Success<T> extends Object implements Try<T>
Try's success projection.
  • Method Details

    • orElseThrow

      public T orElseThrow()
      Description copied from interface: Try
      Gets Try's value or throws exception
      Specified by:
      orElseThrow in interface Try<T>
      Returns:
      value of T in case of success
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Try<T>
    • fold

      public <R> R fold(Function<? super T,? extends R> onSuccess, Function<? super Exception,? extends R> onFailure)
      Specified by:
      fold in interface Try<T>