Class Either.Left<L,R>

java.lang.Object
io.vavr.control.Either.Left<L,R>
Type Parameters:
L - left component type
R - right component type
All Implemented Interfaces:
Either<L,R>, Value<R>, Serializable, Iterable<R>
Enclosing interface:
Either<L,R>

public static final class Either.Left<L,R> extends Object implements Either<L,R>, Serializable
The Left version of an Either.
Author:
Daniel Dietrich
See Also:
  • Method Details

    • get

      public R get()
      Description copied from interface: Either
      Gets the right value if this is a Right or throws if this is a Left.
      Specified by:
      get in interface Either<L,R>
      Specified by:
      get in interface Value<L>
      Returns:
      the right value
    • getLeft

      public L getLeft()
      Description copied from interface: Either
      Returns the left value.
      Specified by:
      getLeft in interface Either<L,R>
      Returns:
      The left value.
    • isLeft

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

      public boolean isRight()
      Description copied from interface: Either
      Returns whether this Either is a Right.
      Specified by:
      isRight in interface Either<L,R>
      Returns:
      true, if this is a Right, false otherwise
    • equals

      public boolean equals(Object obj)
      Description copied from interface: Value
      Clarifies that values have a proper equals() method implemented.

      See Object.equals(Object).

      Specified by:
      equals in interface Either<L,R>
      Specified by:
      equals in interface Value<L>
      Overrides:
      equals in class Object
      Parameters:
      obj - An object
      Returns:
      true, if this equals o, false otherwise
    • hashCode

      public int hashCode()
      Description copied from interface: Value
      Clarifies that values have a proper hashCode() method implemented.

      See Object.hashCode().

      Specified by:
      hashCode in interface Either<L,R>
      Specified by:
      hashCode in interface Value<L>
      Overrides:
      hashCode in class Object
      Returns:
      The hashcode of this object
    • stringPrefix

      public String stringPrefix()
      Description copied from interface: Value
      Returns the name of this Value type, which is used by toString().
      Specified by:
      stringPrefix in interface Value<L>
      Returns:
      This type name.
    • toString

      public String toString()
      Description copied from interface: Value
      Clarifies that values have a proper toString() method implemented.

      See Object.toString().

      Specified by:
      toString in interface Either<L,R>
      Specified by:
      toString in interface Value<L>
      Overrides:
      toString in class Object
      Returns:
      A String representation of this object