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.
Deprecated.
A left projection of an Either.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<L2,R2> Either.LeftProjection <L2, R2> bimap(Function<? super L, ? extends L2> leftMapper, @NonNull Function<? super R, ? extends R2> rightMapper) Deprecated.Applies transformations to the underlyingEitherby delegating toEither.bimap(Function, Function)and returns the left projection of the result.booleanDeprecated.Clarifies that values have a proper equals() method implemented.Deprecated.ReturnsSomevalue of type L if this is a left projection of a Left value and the predicate applies to the underlying value.<U> Either.LeftProjection<U, R> flatMap(@NonNull Function<? super L, ? extends Either.LeftProjection<? extends U, R>> mapper) Deprecated.FlatMaps this LeftProjection.get()Deprecated.Gets theLeftvalue or throws.Deprecated.Gets the Left value or an alternate value, if the projected Either is a Right.getOrElseGet(@NonNull Function<? super R, ? extends L> other) Deprecated.Gets the Left value or an alternate value, if the projected Either is a Right.getOrElseThrow(@NonNull Function<? super R, X> exceptionFunction) Deprecated.Gets the Left value or throws, if the projected Either is a Right.inthashCode()Deprecated.Clarifies that values have a proper hashCode() method implemented.booleanisAsync()Deprecated.ALeftProjection's value is computed synchronously.booleanisEmpty()Deprecated.Checks, thisValueis empty, i.e.booleanisLazy()Deprecated.ALeftProjection's value is computed eagerly.booleanDeprecated.ALeftProjectionis single-valued.iterator()Deprecated.Returns a richio.vavr.collection.Iterator.<U> Either.LeftProjection<U, R> Deprecated.Maps the left value if the projected Either is a Left.orElse(@NonNull Either.LeftProjection<? extends L, ? extends R> other) Deprecated.Returns thisLeftProjectionif the underlyingEitheris aEither.Left, otherwise returns the givenotherprojection.orElse(@NonNull Supplier<? extends Either.LeftProjection<? extends L, ? extends R>> supplier) Deprecated.Returns thisLeftProjectionif the underlyingEitheris aEither.Left, otherwise returns the result of evaluating the givensupplier.voidDeprecated.Runs an action in the case this is a projection on a Right value.Deprecated.Applies the given action to the value if the projected either is a Left.Deprecated.Returns the name of this Value type, which is used by toString().toEither()Deprecated.Returns the underlying either of this projection.toString()Deprecated.Clarifies that values have a proper toString() method implemented.<U> Utransform(@NonNull Function<? super Either.LeftProjection<L, R>, ? extends U> f) Deprecated.Transforms thisLeftProjection.Methods inherited from interface 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
-
Field Details
-
either
-
-
Constructor Details
-
LeftProjection
-
-
Method Details
-
bimap
public <L2,R2> Either.LeftProjection<L2,R2> bimap(Function<? super L, ? extends L2> leftMapper, @NonNull Function<? super R, ? extends R2> rightMapper) Deprecated.Applies transformations to the underlyingEitherby delegating toEither.bimap(Function, Function)and returns the left 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
LeftProjectionwith the transformed values
- If the underlying
-
isAsync
-
isEmpty
-
isLazy
-
isSingleValued
public boolean isSingleValued()Deprecated.ALeftProjectionis single-valued.- Specified by:
isSingleValuedin interfaceValue<L>- Returns:
true
-
get
Deprecated.Gets theLeftvalue or throws.- Specified by:
getin interfaceValue<L>- Returns:
- the left value, if the underlying
Eitheris aLeft - Throws:
NoSuchElementException- if the underlyingEitherof thisLeftProjectionis aRight
-
orElse
public Either.LeftProjection<L,R> orElse(@NonNull Either.LeftProjection<? extends L, ? extends R> other) Deprecated.Returns thisLeftProjectionif the underlyingEitheris aEither.Left, otherwise returns the givenotherprojection.- Parameters:
other- an alternativeLeftProjection- Returns:
- this projection if the underlying
Eitheris aLeft, otherwiseother
-
orElse
public Either.LeftProjection<L,R> orElse(@NonNull Supplier<? extends Either.LeftProjection<? extends L, ? extends R>> supplier) Deprecated.Returns thisLeftProjectionif the underlyingEitheris aEither.Left, otherwise returns the result of evaluating the givensupplier.- Parameters:
supplier- a supplier of an alternativeLeftProjection- Returns:
- this projection if the underlying
Eitheris aLeft, otherwise the result ofsupplier
-
getOrElse
Deprecated.Gets the Left value or an alternate value, if the projected Either is a Right.- Specified by:
getOrElsein interfaceValue<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
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
otherby applying the Right value.
-
orElseRun
-
getOrElseThrow
public <X extends Throwable> L getOrElseThrow(@NonNull 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
exceptionFunctionby applying the Right value. - Throws:
X- if the projected Either is a Right
-
toEither
-
filter
-
flatMap
public <U> Either.LeftProjection<U,R> flatMap(@NonNull 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- ifmapperis null
-
map
Deprecated.Maps the left value if the projected Either is a Left. -
peek
Deprecated.Applies the given action to the value if the projected either is a Left. Otherwise nothing happens. -
transform
Deprecated.Transforms thisLeftProjection.- Type Parameters:
U- Type of transformation result- Parameters:
f- A transformation- Returns:
- An instance of type
U - Throws:
NullPointerException- iffis null
-
iterator
-
equals
Deprecated.Description copied from interface:ValueClarifies that values have a proper equals() method implemented. -
hashCode
-
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
-
Either.swap()instead of projections.