Class Either.Right<L,R>
java.lang.Object
com.dudko.tools.safejavastreams.core.Either<L,R>
com.dudko.tools.safejavastreams.core.Either.Right<L,R>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionApplies a function that returns another Either to Right value.<T> T
Reduces this Either into a single value by applying one of the provided functions.get()
Converts this Either to a Stream.getLeft()
Gets the Left value if present.getRight()
Gets the Right value if present.Executes action if this is Left.Executes action if this is Right.boolean
isLeft()
Checks whether the value is a Left.boolean
isRight()
Checks whether the value is a Right.Maps Right value to another type if present.Allows observing the value (for logging, debugging, etc.).Converts Left into Right using a recovery function.Converts Left into another Either using a recovery function.Converts Right value to Optional, or empty if Left.toString()
Methods inherited from class com.dudko.tools.safejavastreams.core.Either
getOrElse, getOrElseGet, left, right
-
Field Details
-
value
-
-
Constructor Details
-
Right
Right(R value)
-
-
Method Details
-
isRight
public boolean isRight()Description copied from class:Either
Checks whether the value is a Right. -
isLeft
public boolean isLeft()Description copied from class:Either
Checks whether the value is a Left. -
getLeft
Description copied from class:Either
Gets the Left value if present. -
getRight
Description copied from class:Either
Gets the Right value if present. -
map
Description copied from class:Either
Maps Right value to another type if present. If Left, the result remains Left. -
flatMap
Description copied from class:Either
Applies a function that returns another Either to Right value. If Left, the result remains unchanged. -
ifRight
Description copied from class:Either
Executes action if this is Right. -
ifLeft
Description copied from class:Either
Executes action if this is Left. -
fold
public <T> T fold(Function<? super L, ? extends T> leftMapper, Function<? super R, ? extends T> rightMapper) Description copied from class:Either
Reduces this Either into a single value by applying one of the provided functions. -
recover
Description copied from class:Either
Converts Left into Right using a recovery function. -
recoverWith
Description copied from class:Either
Converts Left into another Either using a recovery function.- Specified by:
recoverWith
in classEither<L,
R> - Parameters:
recovery
- function to convert Left into Either- Returns:
- new Either
-
peek
Description copied from class:Either
Allows observing the value (for logging, debugging, etc.). -
toOptional
Description copied from class:Either
Converts Right value to Optional, or empty if Left.- Specified by:
toOptional
in classEither<L,
R> - Returns:
- Optional with Right or empty
-
get
Description copied from class:Either
Converts this Either to a Stream. -
toString
-