Package org.smallibs.data
Interface Try<T>
- All Known Implementing Classes:
Try.Failure,Try.Success
public sealed interface Try<T>
extends Filter<Try,T,Try<T>>, HK<Try,T,Try<T>>
permits Try.Success<T>, Try.Failure<T>
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordFailure implementationstatic final recordSuccess implementation -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Try<T> Method called when the current data must be filtered using a given predicate.<B> Try<B> default <B> Bfold(java.util.function.Function<? super T, B> success, java.util.function.Function<? super Throwable, B> failure) static <O> Try<O> handle(SupplierWithError<O> supplier) default booleandefault <B> Try<B> default TorElseThrow(java.util.function.Function<? super Throwable, ? extends X> exceptionSupplier) orElseThrow(java.util.function.Supplier<? extends X> exceptionSupplier) static <T> Try<T> pure(T value) recoverWith(java.util.function.Function<? super Throwable, T> t) default TrecoverWith(T t) self()static <T> Try<T> success(T value)
-
Method Details
-
handle
-
toPromise
-
pure
-
success
-
failure
-
filter
Description copied from interface:FilterMethod called when the current data must be filtered using a given predicate. -
self
-
map
-
fold
-
recoverWith
-
orElseThrow
default <X extends Throwable> T orElseThrow(java.util.function.Supplier<? extends X> exceptionSupplier) throws X - Throws:
X
-
orElseThrow
- Throws:
Throwable
-
isSuccess
default boolean isSuccess() -
recoverWith
-
orElseThrow
<X extends Throwable> T orElseThrow(java.util.function.Function<? super Throwable, ? extends X> exceptionSupplier) throws X- Throws:
X
-
flatmap
-
onSuccess
-
onFailure
-