-
- All Implemented Interfaces:
public final class TryKt
-
-
Method Summary
Modifier and Type Method Description final static <R extends Any, S extends R, F extends Throwable> RgetOrDefault(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> RgetOrElse(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. -
-
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.
-
flatMap
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)
-
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.
-
-
-
-