Package io.vavr.control
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>,java.lang.Iterable<R>
@Deprecated public static final class Either.RightProjection<L,R> extends java.lang.Object implements Value<R>
Deprecated.Either is right-biased. UseEither.swap()instead of projections.A right projection of an Either.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateRightProjection(Either<L,R> either)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <L2,R2>
Either.RightProjection<L2,R2>bimap(@NonNull java.util.function.Function<? super L,? extends L2> leftMapper, @NonNull java.util.function.Function<? super R,? extends R2> rightMapper)Deprecated.Applies transformations to the underlyingEitherby delegating toEither.bimap(Function, Function)and returns the right projection of the result.booleanequals(java.lang.Object obj)Deprecated.Clarifies that values have a proper equals() method implemented.Option<Either.RightProjection<L,R>>filter(@NonNull java.util.function.Predicate<? super R> predicate)Deprecated.ReturnsSomevalue of type R if this is a right projection of a Right value and the predicate applies to the underlying value.<U> Either.RightProjection<L,U>flatMap(@NonNull java.util.function.Function<? super R,? extends Either.RightProjection<L,? extends U>> mapper)Deprecated.FlatMaps this RightProjection.Rget()Deprecated.Gets theRightvalue or throws.RgetOrElse(R other)Deprecated.Gets the Right value or an alternate value, if the projected Either is a Left.RgetOrElseGet(@NonNull 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.<X extends java.lang.Throwable>
RgetOrElseThrow(@NonNull java.util.function.Function<? super L,X> exceptionFunction)Deprecated.Gets the Right value or throws, if the projected Either is a Left.inthashCode()Deprecated.Clarifies that values have a proper hashCode() method implemented.booleanisAsync()Deprecated.ARightProjection's value is computed synchronously.booleanisEmpty()Deprecated.Checks, thisValueis empty, i.e.booleanisLazy()Deprecated.ARightProjection's value is computed eagerly.booleanisSingleValued()Deprecated.ARightProjectionis single-valued.@NonNull Iterator<R>iterator()Deprecated.Returns a richio.vavr.collection.Iterator.<U> Either.RightProjection<L,U>map(@NonNull java.util.function.Function<? super R,? extends U> mapper)Deprecated.Maps the right value if the projected Either is a Right.Either.RightProjection<L,R>orElse(@NonNull Either.RightProjection<? extends L,? extends R> other)Deprecated.Returns thisRightProjectionif the underlyingEitheris aEither.Right, otherwise returns the givenotherprojection.Either.RightProjection<L,R>orElse(@NonNull java.util.function.Supplier<? extends Either.RightProjection<? extends L,? extends R>> supplier)Deprecated.Returns thisRightProjectionif the underlyingEitheris aEither.Right, otherwise returns the result of evaluating the givensupplier.voidorElseRun(@NonNull java.util.function.Consumer<? super L> action)Deprecated.Runs an action in the case this is a projection on a Left value.Either.RightProjection<L,R>peek(@NonNull java.util.function.Consumer<? super R> action)Deprecated.Applies the given action to the value if the projected either is a Right.java.lang.StringstringPrefix()Deprecated.Returns the name of this Value type, which is used by toString().Either<L,R>toEither()Deprecated.Returns the underlying either of this projection.java.lang.StringtoString()Deprecated.Clarifies that values have a proper toString() method implemented.<U> Utransform(@NonNull java.util.function.Function<? super Either.RightProjection<L,R>,? extends U> f)Deprecated.Transforms thisRightProjection.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.vavr.Value
collect, collect, contains, corresponds, eq, exists, forAll, forEach, getOrElse, getOrElseThrow, getOrElseTry, getOrNull, mapTo, mapToVoid, out, out, spliterator, stderr, stdout, toArray, toCharSeq, toCompletableFuture, toEither, toEither, toInvalid, toInvalid, toJavaArray, toJavaArray, toJavaArray, toJavaCollection, toJavaList, toJavaList, toJavaMap, toJavaMap, toJavaMap, toJavaOptional, toJavaParallelStream, toJavaSet, toJavaSet, toJavaStream, toLeft, toLeft, toLinkedMap, toLinkedMap, toLinkedSet, toList, toMap, toMap, toOption, toPriorityQueue, toPriorityQueue, toQueue, toRight, toRight, toSet, toSortedMap, toSortedMap, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toStream, toTree, toTree, toTry, toTry, toValid, toValid, toValidation, toValidation, toVector
-
-
-
-
Method Detail
-
bimap
public <L2,R2> Either.RightProjection<L2,R2> bimap(@NonNull java.util.function.Function<? super L,? extends L2> leftMapper, @NonNull java.util.function.Function<? super R,? extends R2> rightMapper)
Deprecated.Applies transformations to the underlyingEitherby delegating toEither.bimap(Function, Function)and returns the right projection of the result.- If the underlying
Eitheris aEither.Left,leftMapperis applied to the left value. - If the underlying
Eitheris aEither.Right,rightMapperis applied to the right value.
- Type Parameters:
L2- the type of the left value in the resulting projectionR2- the type of the right value in the resulting projection- Parameters:
leftMapper- function to transform the left valuerightMapper- function to transform the right value- Returns:
- a new
RightProjectionwith the transformed values
- If the underlying
-
isAsync
public boolean isAsync()
Deprecated.ARightProjection's value is computed synchronously.
-
isEmpty
public boolean isEmpty()
Deprecated.Description copied from interface:ValueChecks, thisValueis empty, i.e. if the underlying value is absent.
-
isLazy
public boolean isLazy()
Deprecated.ARightProjection's value is computed eagerly.
-
isSingleValued
public boolean isSingleValued()
Deprecated.ARightProjectionis single-valued.- Specified by:
isSingleValuedin interfaceValue<L>- Returns:
true
-
get
public R get()
Deprecated.Gets theRightvalue or throws.
-
orElse
public Either.RightProjection<L,R> orElse(@NonNull Either.RightProjection<? extends L,? extends R> other)
Deprecated.Returns thisRightProjectionif the underlyingEitheris aEither.Right, otherwise returns the givenotherprojection.- Parameters:
other- an alternativeRightProjection- Returns:
- this projection if the underlying
Eitheris aRight, otherwiseother
-
orElse
public Either.RightProjection<L,R> orElse(@NonNull java.util.function.Supplier<? extends Either.RightProjection<? extends L,? extends R>> supplier)
Deprecated.Returns thisRightProjectionif the underlyingEitheris aEither.Right, otherwise returns the result of evaluating the givensupplier.- Parameters:
supplier- a supplier of an alternativeRightProjection- Returns:
- this projection if the underlying
Eitheris aRight, otherwise the result ofsupplier
-
getOrElse
public R getOrElse(R other)
Deprecated.Gets the Right value or an alternate value, if the projected Either is a Left.
-
getOrElseGet
public R getOrElseGet(@NonNull 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
otherby applying the Left value.
-
orElseRun
public void orElseRun(@NonNull 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(@NonNull 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
exceptionFunctionby applying the Left value. - Throws:
X- if the projected Either is a LeftX 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(@NonNull java.util.function.Predicate<? super R> predicate)
Deprecated.ReturnsSomevalue 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(@NonNull 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- ifmapperis null
-
map
public <U> Either.RightProjection<L,U> map(@NonNull java.util.function.Function<? super R,? extends U> mapper)
Deprecated.Maps the right value if the projected Either is a Right.
-
peek
public Either.RightProjection<L,R> peek(@NonNull 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.
-
transform
public <U> U transform(@NonNull java.util.function.Function<? super Either.RightProjection<L,R>,? extends U> f)
Deprecated.Transforms thisRightProjection.- Type Parameters:
U- Type of transformation result- Parameters:
f- A transformation- Returns:
- An instance of type
U - Throws:
java.lang.NullPointerException- iffis null
-
iterator
public @NonNull Iterator<R> iterator()
Deprecated.Description copied from interface:ValueReturns a richio.vavr.collection.Iterator.
-
equals
public boolean equals(java.lang.Object obj)
Deprecated.Description copied from interface:ValueClarifies that values have a proper equals() method implemented.
-
hashCode
public int hashCode()
Deprecated.Description copied from interface:ValueClarifies that values have a proper hashCode() method implemented.See Object.hashCode().
-
stringPrefix
public java.lang.String stringPrefix()
Deprecated.Description copied from interface:ValueReturns the name of this Value type, which is used by toString().- Specified by:
stringPrefixin interfaceValue<L>- Returns:
- This type name.
-
toString
public java.lang.String toString()
Deprecated.Description copied from interface:ValueClarifies that values have a proper toString() method implemented.See Object.toString().
-
-