Class 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>, java.lang.Iterable<R>
    Enclosing interface:
    Either<L,​R>

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

      • either

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

      • RightProjection

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

      • bimap

        public <L2,​R2> Either.RightProjection<L2,​R2> bimap​(java.util.function.Function<? super L,​? extends L2> leftMapper,
                                                                       java.util.function.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:
        java.util.NoSuchElementException - if the underlying Either of this RightProjection is a Left
      • 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:
        java.util.NoSuchElementException - if the underlying either of this RightProjection is a Left
      • getOrElseGet

        public R getOrElseGet​(java.util.function.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​(java.util.function.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 java.lang.Throwable> R getOrElseThrow​(java.util.function.Function<? super L,​X> exceptionFunction)
                                                         throws X extends java.lang.Throwable
        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
        X extends java.lang.Throwable
      • 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​(java.util.function.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​(java.util.function.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:
        java.lang.NullPointerException - if mapper is null
      • map

        public <U> Either.RightProjection<L,​U> map​(java.util.function.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​(java.util.function.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​(java.util.function.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:
        java.lang.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 java.lang.Iterable<L>
        Specified by:
        iterator in interface Value<L>
        Returns:
        A new Iterator
      • equals

        public boolean equals​(java.lang.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 java.lang.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 java.lang.Object
        Returns:
        The hashcode of this object
      • stringPrefix

        public java.lang.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 java.lang.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 java.lang.Object
        Returns:
        A String representation of this object