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

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

      • either

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

      • LeftProjection

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

      • bimap

        public <L2,​R2> Either.LeftProjection<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 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:
        java.util.NoSuchElementException - if the underlying Either of this LeftProjection is a Right
      • 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:
        java.util.NoSuchElementException - if the underlying either of this LeftProjection is a Right
      • getOrElseGet

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

        public <U> Either.LeftProjection<U,​R> map​(java.util.function.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​(java.util.function.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​(java.util.function.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:
        java.lang.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 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