Class Either.RightProjection<L,R>

java.lang.Object
io.vavr.control.Either.RightProjection<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<R>, Iterable<R>
Enclosing interface:
Either<L,R>

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

    • either

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

    • RightProjection

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

    • bimap

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

      public boolean isAsync()
      Deprecated.
      A RightProjection'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 RightProjection's value is computed eagerly.
      Specified by:
      isLazy in interface Value<L>
      Returns:
      false
    • isSingleValued

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

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

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

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

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

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

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

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

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

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

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

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

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

      public <U> U transform(Function<? super Either.RightProjection<L,R>,? extends U> f)
      Deprecated.
      Transforms this RightProjection.
      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<R> 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