Package io.atlassian.fugue
Class Either.LeftProjection
java.lang.Object
Either<L,R>.io.atlassian.fugue.Either.AbstractProjection<L,R>
io.atlassian.fugue.Either.LeftProjection
- All Implemented Interfaces:
Effect.Applicant<L>,Either.Projection<L,,R, L, R> Maybe<L>,Iterable<L>
public final class Either.LeftProjection
extends Either<L,R>.AbstractProjection<L,R>
implements Either.Projection<L,R,L,R>
A left projection of an either value.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionFunction application on this projection's value.Deprecated.since 3.0as()Coerces our right type as X.ReturnsNoneif this projection has no value or if the given predicatepdoes not hold for the value, otherwise, returns a left inSome.filterOrElse(Predicate<? super L> p, Supplier<? extends R> orElseSupplier) Return aLeftif this is aLeftand the contained values satisfies the given predicate.Binds the given function across this projection's value if it has one.get()Get the value if defined.booleanIf the type contains a value return true.Map the given function across this projection's value if it has one.The value of this projection or the result of the given function on the opposing projection's value.Anonymous bind through this projection.(package private) <X> Either.Right<X, R> toRight()Methods inherited from class io.atlassian.fugue.Either.AbstractProjection
contains, either, exists, forall, foreach, forEach, getOr, getOrElse, getOrElse, getOrError, getOrNull, getOrThrow, isEmpty, iterator, toOption, toOptional, toStreamMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.atlassian.fugue.Effect.Applicant
foreachMethods inherited from interface io.atlassian.fugue.Either.Projection
either, toOption, toOptional, toStreamMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
LeftProjection
private LeftProjection()
-
-
Method Details
-
get
Description copied from interface:MaybeGet the value if defined. Throw an exception otherwise. -
isDefined
public boolean isDefined()Description copied from interface:MaybeIf the type contains a value return true. -
on
Description copied from interface:Either.ProjectionThe value of this projection or the result of the given function on the opposing projection's value. -
map
Map the given function across this projection's value if it has one.- Type Parameters:
X- the LHS type- Parameters:
f- The function to map across this projection, must not return null- Returns:
- A new either value after mapping.
-
flatMap
Binds the given function across this projection's value if it has one.- Type Parameters:
X- the LHS typeRR- The existing RHS or a subtype- Parameters:
f- The function to bind across this projection.- Returns:
- A new either value after binding.
-
toRight
-
sequence
Anonymous bind through this projection.- Type Parameters:
X- the LHS type- Parameters:
e- The value to bind with.- Returns:
- An either after binding through this projection.
-
filter
ReturnsNoneif this projection has no value or if the given predicatepdoes not hold for the value, otherwise, returns a left inSome.- Type Parameters:
X- the RHS type- Parameters:
f- The predicate function to test on this projection's value.- Returns:
Noneif this projection has no value or if the given predicatepdoes not hold for the value, otherwise, returns a left inSome.
-
filterOrElse
Return aLeftif this is aLeftand the contained values satisfies the given predicate. If this is aLeftbut the predicate is not satisfied, return aRightwith the value provided by the orElseSupplier. Return aRightif this aRightwith the contained value.- Parameters:
p- The predicate function to test on the right contained value.orElseSupplier- The supplier to execute when is a left, and predicate is unsatisfied- Returns:
- a new Either that will be either the existing left/right or a right with result of orElseSupplier
- Since:
- 4.7.0
-
ap
Function application on this projection's value.- Type Parameters:
X- the LHS type- Parameters:
either- The either of the function to apply on this projection's value.- Returns:
- The result of function application within either.
- Since:
- 3.0
-
apply
Deprecated.since 3.0Function application on this projection's value.- Type Parameters:
X- the LHS type- Parameters:
either- The either of the function to apply on this projection's value.- Returns:
- The result of function application within either.
- See Also:
-
as
Coerces our right type as X. Dangerous, isLeft() must be true- Type Parameters:
X- the type to coerce to.- Returns:
- an either with the coerced right type.
-