java.lang.Object
net.luis.utils.util.Either<L,R>
net.luis.utils.util.Either.Left<L,R>
- Type Parameters:
L- The type of the left valueR- The type of the right value
Left implementation of the either.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.luis.utils.util.Either
Either.Left<L,R>, Either.Right<L, R> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()voidPerforms the given action if this either instance is a left instance.voidPerforms the given action if this either instance is a right instance.booleanisLeft()Checks if this either instance is a left instance.booleanisRight()Checks if this either instance is a right instance.left()Returns the left value as anOptional.@UnknownNullability LReturns the left value or throws an exception if it is a right either.<C,D> @NotNull Either <C, D> mapBoth(@NotNull Function<? super L, ? extends C> leftMapper, @NotNull Function<? super R, ? extends D> rightMapper) Maps the left and right values of this either instance to new values.<T> TmapTo(@NotNull Function<? super L, ? extends T> leftMapper, @NotNull Function<? super R, ? extends T> rightMapper) Maps the left and right values of this either instance to a new value.right()Returns the right value as anOptional.Returns the right value or throws an exception if it is a left either.toString()
-
Field Details
-
value
The value of the left either.
-
-
Constructor Details
-
Left
Constructs a new left either instance with the given value.- Parameters:
value- The value of the left either
-
-
Method Details
-
isLeft
public boolean isLeft()Description copied from class:EitherChecks if this either instance is a left instance. -
isRight
public boolean isRight()Description copied from class:EitherChecks if this either instance is a right instance. -
ifLeft
Description copied from class:EitherPerforms the given action if this either instance is a left instance. -
ifRight
Description copied from class:EitherPerforms the given action if this either instance is a right instance. -
left
Description copied from class:EitherReturns the left value as anOptional. -
right
Description copied from class:EitherReturns the right value as anOptional. -
leftOrThrow
Description copied from class:EitherReturns the left value or throws an exception if it is a right either.- Specified by:
leftOrThrowin classEither<L,R> - Returns:
- The left value
-
rightOrThrow
Description copied from class:EitherReturns the right value or throws an exception if it is a left either.- Specified by:
rightOrThrowin classEither<L,R> - Returns:
- The right value
-
mapBoth
@NotNull public <C,D> @NotNull Either<C,D> mapBoth(@NotNull @NotNull Function<? super L, ? extends C> leftMapper, @NotNull @NotNull Function<? super R, ? extends D> rightMapper) Description copied from class:EitherMaps the left and right values of this either instance to new values. -
mapTo
public <T> T mapTo(@NotNull @NotNull Function<? super L, ? extends T> leftMapper, @NotNull @NotNull Function<? super R, ? extends T> rightMapper) Description copied from class:EitherMaps the left and right values of this either instance to a new value. -
equals
-
hashCode
public int hashCode() -
toString
-