Expected

open class Expected<E, V>

Expected is wrapper object around either a value or an error.

Parameters

<E>

The error type of expected

<V>

The value type of expected

Types

Link copied to clipboard
Functional interface to run an action on expected types.
Link copied to clipboard
Functional interface to transform expected types.

Functions

Link copied to clipboard
open fun <R> fold(@NonNull errorFun: Expected.Transformer<E, R>, @NonNull valueFun: Expected.Transformer<V, R>): R
Fold the expected to a common type.
Link copied to clipboard
Return the value if available, or produce a fallback with the provided function.
Link copied to clipboard
open fun isError(): Boolean
Return if the expected contains an error.
Link copied to clipboard
open fun isValue(): Boolean
Return if the expected contains a value.
Link copied to clipboard
open fun <E1, V1> map(@NonNull errorFun: Expected.Transformer<E, E1>, @NonNull valueFun: Expected.Transformer<V, V1>): Expected<E1, V1>
Map both value or error to a new type.
Link copied to clipboard
Map error to a new type or return encapsulated value.
Link copied to clipboard
Map value to a new type or return the encapsulated error.
Link copied to clipboard
Execute an action if this expected is an error.
Link copied to clipboard
Execute an action if this expected is a value.

Properties

Link copied to clipboard
Link copied to clipboard