Package 

Class TryKt

  • All Implemented Interfaces:

    
    public final class TryKt
    
                        
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final static <R extends Any, S extends R, F extends Throwable> R getOrDefault(Try<S, F> $self, R defaultValue) Returns the encapsulated value if this instance represents success or the defaultValue if it is failure.
      final static <R extends Any, S extends R, F extends Throwable> R getOrElse(Try<S, F> $self, Function1<F, R> onFailure) Returns the encapsulated value if this instance represents success or the result of onFailure function for the encapsulated Throwable exception if it is failure.
      final static <R extends Any, S extends Any, F extends Throwable> Try<R, F> flatMap(Try<S, F> $self, Function1<S, Try<R, F>> transform)
      final static <R extends Any, S extends R, F extends Throwable> Try<R, Void> recover(Try<S, F> $self, Function1<F, R> transform) Returns the encapsulated result of the given transform function applied to the encapsulated |Throwable] exception if this instance represents failure or the original encapsulated value if it is success.
      final static <R extends Any, S extends R, F extends Throwable> Try<R, F> tryRecover(Try<S, F> $self, Function1<F, Try<R, F>> transform) Returns the encapsulated result of the given transform function applied to the encapsulated |Throwable] exception if this instance represents failure or the original encapsulated value if it is success.
      • Methods inherited from class java.lang.Object

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

    • Method Detail

      • getOrDefault

         final static <R extends Any, S extends R, F extends Throwable> R getOrDefault(Try<S, F> $self, R defaultValue)

        Returns the encapsulated value if this instance represents success or the defaultValue if it is failure.

      • getOrElse

         final static <R extends Any, S extends R, F extends Throwable> R getOrElse(Try<S, F> $self, Function1<F, R> onFailure)

        Returns the encapsulated value if this instance represents success or the result of onFailure function for the encapsulated Throwable exception if it is failure.

      • recover

         final static <R extends Any, S extends R, F extends Throwable> Try<R, Void> recover(Try<S, F> $self, Function1<F, R> transform)

        Returns the encapsulated result of the given transform function applied to the encapsulated |Throwable] exception if this instance represents failure or the original encapsulated value if it is success.

      • tryRecover

         final static <R extends Any, S extends R, F extends Throwable> Try<R, F> tryRecover(Try<S, F> $self, Function1<F, Try<R, F>> transform)

        Returns the encapsulated result of the given transform function applied to the encapsulated |Throwable] exception if this instance represents failure or the original encapsulated value if it is success.