Class Try.Success<A>

java.lang.Object
com.jnape.palatable.lambda.adt.Try<A>
com.jnape.palatable.lambda.adt.Try.Success<A>
All Implemented Interfaces:
CoProduct2<Throwable,A,Try<A>>, Applicative<A,Try<?>>, Functor<A,Try<?>>, Monad<A,Try<?>>, MonadError<Throwable,A,Try<?>>, MonadRec<A,Try<?>>, Traversable<A,Try<?>>
Enclosing class:
Try<A>

private static final class Try.Success<A> extends Try<A>
  • Field Details

    • a

      private final A a
  • Constructor Details

    • Success

      private Success(A a)
  • Method Details

    • orThrow

      public <T extends Throwable> A orThrow(Fn1<? super Throwable,? extends T> fn)
      Description copied from class: Try
      If this is a success value, return it. Otherwise, transform the captured failure with fn and throw the result.
      Specified by:
      orThrow in class Try<A>
      Type Parameters:
      T - the type of the thrown Throwable
      Parameters:
      fn - the Throwable transformation
      Returns:
      possibly the success value
    • match

      public <R> R match(Fn1<? super Throwable,? extends R> aFn, Fn1<? super A,? extends R> bFn)
      Description copied from interface: CoProduct2
      Type-safe convergence requiring a match against all potential types.
      Type Parameters:
      R - result type
      Parameters:
      aFn - morphism A -> R
      bFn - morphism B -> R
      Returns:
      the result of applying the appropriate morphism to this coproduct's unwrapped value
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object