Interface Try<T>
- Type Parameters:
T
- type of the computed result in the successful case
- All Known Implementing Classes:
Try.Failure
,Try.Success
Functional programming strives to minimize side effects, so throwing exceptions is avoided. Instead, if an operation can fail, it should return a
representation of its outcome including an indication of success or failure, as well as its result (if successful), or some error data otherwise. In other
words, errors in functional programming are just payload.
Try should be preferred in functional programming approaches in particular in the context of stream pipelines.
-
Method Details
-
isSuccess
boolean isSuccess() -
isFailure
default boolean isFailure() -
onSuccess
-
onFailure
-
getThrown
Throwable getThrown() -
get
-
map
-
flatMap
-
failure
-
success
-
of
-