Class Either.Left<L,R>

java.lang.Object
io.atlassian.fugue.Either<L,R>
io.atlassian.fugue.Either.Left<L,R>
All Implemented Interfaces:
Serializable
Enclosing class:
Either<L,R>

static final class Either.Left<L,R> extends Either<L,R>
Since:
1.0
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • value

      private final L value
  • Constructor Details

    • Left

      public Left(L value)
  • Method Details

    • getLeft

      final L getLeft()
      Overrides:
      getLeft in class Either<L,R>
    • isLeft

      public boolean isLeft()
      Description copied from class: Either
      Returns true if this either is a left, false otherwise.
      Specified by:
      isLeft in class Either<L,R>
      Returns:
      true if this either is a left, false otherwise.
    • isRight

      public boolean isRight()
      Description copied from class: Either
      Returns true if this either is a right, false otherwise.
      Specified by:
      isRight in class Either<L,R>
      Returns:
      true if this either is a right, false otherwise.
    • swap

      public Either<R,L> swap()
      Description copied from class: Either
      If this is a left, then return the left value in right, or vice versa.
      Specified by:
      swap in class Either<L,R>
      Returns:
      an Either that is a Left if this is a Right or a Right if this is a Left. The value remains the same.
    • fold

      public <V> V fold(Function<? super L, V> ifLeft, Function<? super R, V> ifRight)
      Description copied from class: Either
      Applies the function to the wrapped value, applying ifLeft if this is a Left and ifRight if this is a Right.
      Specified by:
      fold in class Either<L,R>
      Type Parameters:
      V - the destination type
      Parameters:
      ifLeft - the function to apply if this is a Left
      ifRight - the function to apply if this is a Right
      Returns:
      the result of the applies function
    • bimap

      public <LL,RR> Either<LL,RR> bimap(Function<? super L, ? extends LL> ifLeft, Function<? super R, ? extends RR> ifRight)
      Description copied from class: Either
      Map the given functions across the appropriate side.
      Specified by:
      bimap in class Either<L,R>
      Type Parameters:
      LL - the LHS type
      RR - the RHS type
      Parameters:
      ifLeft - The function to map if this Either is a left.
      ifRight - The function to map if this Either is a right.
      Returns:
      A new either value after mapping with the appropriate function applied.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object