/** * Constructs an Either containing a left value. * * @param left The left value to store in the either * @param <L> The type of the left value * @param <R> The type of the right value * * @return An Either wrapping the left value */ public static <L, R> Either<L, R> left(L left) { return new Either<>(left, null, true); }
/** * Constructs an Either containing a right value. * * @param right The right value to store in the either * @param <L> The type of the left value * @param <R> The type of the right value * * @return An Either wrapping the right value */ public static <L, R> Either<L, R> right(R right) { return new Either<>(null, right, false); }