Package nva.commons.core.attempt
Class Success<T>
java.lang.Object
nva.commons.core.attempt.Try<T>
nva.commons.core.attempt.Success<T>
-
Field Summary
FieldsFields inherited from class nva.commons.core.attempt.Try
NULL_ACTION_MESSAGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanflatMap(FunctionWithException<T, Try<S>, E> action) forEach(ConsumerWithException<T, E> action) A wrapper for consumers that throw checked Exceptions.get()inthashCode()booleanmap(FunctionWithException<T, S, E> mapper) orElse(FunctionWithException<Failure<T>, T, E> action) orElseThrow(Function<Failure<T>, E> action) stream()toOptional(ConsumerWithException<Failure<T>, E> action)
-
Field Details
-
value
-
-
Constructor Details
-
Success
-
-
Method Details
-
stream
-
isSuccess
public boolean isSuccess() -
get
-
getException
- Specified by:
getExceptionin classTry<T>
-
map
-
flatMap
-
orElseThrow
- Specified by:
orElseThrowin classTry<T>- Throws:
E extends Exception
-
orElseThrow
- Specified by:
orElseThrowin classTry<T>
-
orElse
-
toOptional
public <E extends Exception> Optional<T> toOptional(ConsumerWithException<Failure<T>, E> action) throws E- Specified by:
toOptionalin classTry<T>- Throws:
E extends Exception
-
toOptional
- Specified by:
toOptionalin classTry<T>
-
or
-
forEach
A wrapper for consumers that throw checked Exceptions. See "https://www.oreilly .com/content/handling-checked-exceptions-in-java-streams/" Try to perform the action. Any exception will be enclosed in a Failure. -
equals
-
hashCode
public int hashCode()
-