Class Either<L,​R>

  • Type Parameters:
    L - Type left
    R - Type right

    public final class Either<L,​R>
    extends Object
    Either is an immutable object, it contains left XOR right element.
    Author:
    pchretien
    • 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 element
        R - 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 element
        R - the right type element
        Parameters:
        left - the left element
        Returns:
        the created Either object
      • left

        public Optional<L> left()
        Returns:
        the left optional element
      • right

        public Optional<R> right()
        Returns:
        the right optional element