Class Either.LeftProjection<L,R>

java.lang.Object
io.vavr.control.Either.LeftProjection<L,R>
Type Parameters:
L - The type of the Left value of an Either.
R - The type of the Right value of an Either.
All Implemented Interfaces:
Value<L>, Iterable<L>
Enclosing interface:
Either<L,R>

@Deprecated public static final class Either.LeftProjection<L,R> extends Object implements Value<L>
Deprecated.
Either is right-biased. Use Either.swap() instead of projections.
A left projection of an Either.
  • Field Details

    • either

      private final Either<L,R> either
      Deprecated.
  • Constructor Details

    • LeftProjection

      private LeftProjection(Either<L,R> either)
      Deprecated.
  • Method Details

    • bimap

      public <L2, R2> Either.LeftProjection<L2,R2> bimap(Function<? super L,? extends L2> leftMapper, Function<? super R,? extends R2> rightMapper)
      Deprecated.
    • isAsync

      public boolean isAsync()
      Deprecated.
      A LeftProjection's value is computed synchronously.
      Specified by:
      isAsync in interface Value<L>
      Returns:
      false
    • isEmpty

      public boolean isEmpty()
      Deprecated.
      Description copied from interface: Value
      Checks, this Value is empty, i.e. if the underlying value is absent.
      Specified by:
      isEmpty in interface Value<L>
      Returns:
      false, if no underlying value is present, true otherwise.
    • isLazy

      public boolean isLazy()
      Deprecated.
      A LeftProjection's value is computed eagerly.
      Specified by:
      isLazy in interface Value<L>
      Returns:
      false
    • isSingleValued

      public boolean isSingleValued()
      Deprecated.
      A LeftProjection is single-valued.
      Specified by:
      isSingleValued in interface Value<L>
      Returns:
      true
    • get

      public L get()
      Deprecated.
      Gets the Left value or throws.
      Specified by:
      get in interface Value<L>
      Returns:
      the left value, if the underlying Either is a Left
      Throws:
      NoSuchElementException - if the underlying Either of this LeftProjection is a Right
    • orElse

      public Either.LeftProjection<L,R> orElse(Either.LeftProjection<? extends L,? extends R> other)
      Deprecated.
    • orElse

      public Either.LeftProjection<L,R> orElse(Supplier<? extends Either.LeftProjection<? extends L,? extends R>> supplier)
      Deprecated.
    • getOrElse

      public L getOrElse(L other)
      Deprecated.
      Gets the Left value or an alternate value, if the projected Either is a Right.
      Specified by:
      getOrElse in interface Value<L>
      Parameters:
      other - an alternative value
      Returns:
      the left value, if the underlying Either is a Left or else other
      Throws:
      NoSuchElementException - if the underlying either of this LeftProjection is a Right
    • getOrElseGet

      public L getOrElseGet(Function<? super R,? extends L> other)
      Deprecated.
      Gets the Left value or an alternate value, if the projected Either is a Right.
      Parameters:
      other - a function which converts a Right value to an alternative Left value
      Returns:
      the left value, if the underlying Either is a Left or else the alternative Left value provided by other by applying the Right value.
    • orElseRun

      public void orElseRun(Consumer<? super R> action)
      Deprecated.
      Runs an action in the case this is a projection on a Right value.
      Parameters:
      action - an action which consumes a Right value
    • getOrElseThrow

      public <X extends Throwable> L getOrElseThrow(Function<? super R,X> exceptionFunction) throws X
      Deprecated.
      Gets the Left value or throws, if the projected Either is a Right.
      Type Parameters:
      X - a throwable type
      Parameters:
      exceptionFunction - a function which creates an exception based on a Right value
      Returns:
      the left value, if the underlying Either is a Left or else throws the exception provided by exceptionFunction by applying the Right value.
      Throws:
      X - if the projected Either is a Right
    • toEither

      public Either<L,R> toEither()
      Deprecated.
      Returns the underlying either of this projection.
      Returns:
      the underlying either
    • filter

      public Option<Either.LeftProjection<L,R>> filter(Predicate<? super L> predicate)
      Deprecated.
      Returns Some value of type L if this is a left projection of a Left value and the predicate applies to the underlying value.
      Parameters:
      predicate - A predicate
      Returns:
      A new Option
    • flatMap

      public <U> Either.LeftProjection<U,R> flatMap(Function<? super L,? extends Either.LeftProjection<? extends U,R>> mapper)
      Deprecated.
      FlatMaps this LeftProjection.
      Type Parameters:
      U - Component type of the mapped left value
      Parameters:
      mapper - A mapper
      Returns:
      this as LeftProjection<L, U> if a Right is underlying, otherwise a the mapping result of the left value.
      Throws:
      NullPointerException - if mapper is null
    • map

      public <U> Either.LeftProjection<U,R> map(Function<? super L,? extends U> mapper)
      Deprecated.
      Maps the left value if the projected Either is a Left.
      Specified by:
      map in interface Value<L>
      Type Parameters:
      U - The new type of a Left value
      Parameters:
      mapper - A mapper which takes a left value and returns a value of type U
      Returns:
      A new LeftProjection
    • peek

      public Either.LeftProjection<L,R> peek(Consumer<? super L> action)
      Deprecated.
      Applies the given action to the value if the projected either is a Left. Otherwise nothing happens.
      Specified by:
      peek in interface Value<L>
      Parameters:
      action - An action which takes a left value
      Returns:
      this LeftProjection
    • transform

      public <U> U transform(Function<? super Either.LeftProjection<L,R>,? extends U> f)
      Deprecated.
      Transforms this LeftProjection.
      Type Parameters:
      U - Type of transformation result
      Parameters:
      f - A transformation
      Returns:
      An instance of type U
      Throws:
      NullPointerException - if f is null
    • iterator

      public Iterator<L> iterator()
      Deprecated.
      Description copied from interface: Value
      Returns a rich io.vavr.collection.Iterator.
      Specified by:
      iterator in interface Iterable<L>
      Specified by:
      iterator in interface Value<L>
      Returns:
      A new Iterator
    • equals

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

      See Object.equals(Object).

      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()
      Deprecated.
      Description copied from interface: Value
      Clarifies that values have a proper hashCode() method implemented.

      See Object.hashCode().

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

      public String stringPrefix()
      Deprecated.
      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()
      Deprecated.
      Description copied from interface: Value
      Clarifies that values have a proper toString() method implemented.

      See Object.toString().

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