Package io.vertigo.core.lang
Class Either<L,R>
- java.lang.Object
-
- io.vertigo.core.lang.Either<L,R>
-
- Type Parameters:
L- Type leftR- Type right
public final class Either<L,R> extends Object
Either is an immutable object, it contains left XOR right element.- Author:
- pchretien
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<L>left()static <L,R>
Either<L,R>left(L left)Creates an Either with a left element.Optional<R>right()static <L,R>
Either<L,R>right(R right)Creates an Either with a right element.
-
-
-
Method Detail
-
right
public static <L,R> Either<L,R> right(R right)
Creates an Either with a right element.- Type Parameters:
L- the left type elementR- the right type element- Parameters:
right- the right element the left element is empty.- Returns:
- the created Either object
-
left
public static <L,R> Either<L,R> left(L left)
Creates an Either with a left element.- Type Parameters:
L- the left type elementR- the right type element- Parameters:
left- the left element- Returns:
- the created Either object
-
-