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> TReduces 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.booleanisLeft()Checks whether the value is a Left.booleanisRight()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:EitherChecks whether the value is a Right. -
isLeft
public boolean isLeft()Description copied from class:EitherChecks whether the value is a Left. -
getLeft
Description copied from class:EitherGets the Left value if present. -
getRight
Description copied from class:EitherGets the Right value if present. -
map
Description copied from class:EitherMaps Right value to another type if present. If Left, the result remains Left. -
flatMap
Description copied from class:EitherApplies a function that returns another Either to Right value. If Left, the result remains unchanged. -
ifRight
Description copied from class:EitherExecutes action if this is Right. -
ifLeft
Description copied from class:EitherExecutes 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:EitherReduces this Either into a single value by applying one of the provided functions. -
recover
Description copied from class:EitherConverts Left into Right using a recovery function. -
recoverWith
Description copied from class:EitherConverts Left into another Either using a recovery function.- Specified by:
recoverWithin classEither<L,R> - Parameters:
recovery- function to convert Left into Either- Returns:
- new Either
-
peek
Description copied from class:EitherAllows observing the value (for logging, debugging, etc.). -
toOptional
Description copied from class:EitherConverts Right value to Optional, or empty if Left.- Specified by:
toOptionalin classEither<L,R> - Returns:
- Optional with Right or empty
-
get
Description copied from class:EitherConverts this Either to a Stream. -
toString
-