java.lang.Object
com.github.nullterminated.trylambda.Either<A,B>
com.github.nullterminated.trylambda.Either.Left<A,B>
All Implemented Interfaces:
Serializable
Enclosing class:
Either<A,B>

public static final class Either.Left<A,B> extends Either<A,B>
See Also:
  • Method Details

    • getLeft

      public A getLeft()
      Specified by:
      getLeft in class Either<A,B>
      Returns:
      the left value
    • getRight

      public B getRight()
      Specified by:
      getRight in class Either<A,B>
      Returns:
      the right value
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • use

      public void use(Consumer<A> leftConsumer, Consumer<B> rightConsumer)
      Description copied from class: Either
      Pass the value of this either to a consumer.
      Specified by:
      use in class Either<A,B>
      Parameters:
      leftConsumer - the consumer for lefts
      rightConsumer - the consumer for rights
    • map

      public <X, Y> Either<X,Y> map(Function<A,X> leftFunction, Function<B,Y> rightFunction)
      Description copied from class: Either
      Map this Either<A,B> to a new Either<X,Y>.
      Specified by:
      map in class Either<A,B>
      Type Parameters:
      X - the new left type
      Y - the new right type
      Parameters:
      leftFunction - function to convert A to X
      rightFunction - function to convert B to Y
      Returns:
      a new Either<X,Y>
    • reduce

      public <T> T reduce(Function<A,T> leftFunction, Function<B,T> rightFunction)
      Description copied from class: Either
      Reduce an Either<A,B> to a single value type T.
      Specified by:
      reduce in class Either<A,B>
      Type Parameters:
      T - the result type
      Parameters:
      leftFunction - function to convert A to T
      rightFunction - function to convert B to T
      Returns:
      a value typed T
    • flip

      public Either<B,A> flip()
      Description copied from class: Either
      Flip an Either<A,B> to a Either<B,A>.
      Specified by:
      flip in class Either<A,B>
      Returns:
      a new either with types flipped