public final class Either.RightProjection extends Object implements Either.Projection<R,L,L,R>
| Modifier and Type | Method and Description |
|---|---|
<X> Either<L,X> |
ap(Either<L,Function<R,X>> either)
Function application on this projection's value.
|
<X> Either<L,X> |
apply(Either<L,Function<R,X>> either)
Deprecated.
since 3.0 see ap
|
Either<L,R> |
either()
The either value underlying this projection.
|
boolean |
exists(Predicate<? super A> f)
Whether this is
is defined and
applying the predicate to the contained value returns true. |
<X> Option<Either<X,R>> |
filter(Predicate<? super R> f)
Returns
None if this projection has no value or if the given
predicate p does not hold for the value, otherwise, returns
a right in Some. |
Either<L,R> |
filterOrElse(Predicate<? super R> p,
Supplier<? extends L> orElseSupplier)
Return a
Right if this is a Right and the
contained values satisfies the given predicate. |
<X,LL extends L> |
flatMap(Function<? super R,Either<LL,X>> f)
Binds the given function across this projection's value if it has one.
|
boolean |
forall(Predicate<? super A> f)
Returns
true if empty or the result of the
application of the given function to the value. |
void |
forEach(Consumer<? super A> f) |
void |
foreach(Effect<? super A> f)
Deprecated.
|
R |
get()
Get the value if defined.
|
A |
getOr(Supplier<? extends A> a)
Get the value
if defined or call the supplier and
return its value if not. |
A |
getOrElse(Supplier<? extends A> a)
Deprecated.
|
<X extends A> |
getOrElse(X x)
Get the value if defined, otherwise returns
other. |
A |
getOrError(Supplier<String> err)
Get the value or throws an error with the supplied message if not defined.
|
A |
getOrNull()
Get the value if defined or null if not.
|
<X extends Throwable> |
getOrThrow(Supplier<X> ifUndefined)
Get the value or throws the supplied throwable if not defined.
|
boolean |
isDefined()
If the type contains a value return true.
|
boolean |
isEmpty()
If the type does not contain a value return true.
|
Iterator<A> |
iterator()
Return an iterator for this type.
|
<X> Either<L,X> |
map(Function<? super R,X> f)
Map the given function across this projection's value if it has one.
|
R |
on(Function<? super L,? extends R> f)
The value of this projection or the result of the given function on the
opposing projection's value.
|
<X> Either<L,X> |
sequence(Either<L,X> e)
Anonymous bind through this projection.
|
Option<A> |
toOption()
Returns this projection's value in
Some if it exists,
otherwise None. |
Optional<A> |
toOptional()
Returns this projection's value in
Optional.of(T) if it exists,
otherwise Optional.empty(). |
Stream<A> |
toStream()
Returns this projection's value in
Stream.of(T) if it exists,
otherwise Stream.empty(). |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waiteither, toOption, toOptional, toStreamexists, forall, getOr, getOrElse, getOrElse, getOrError, getOrNull, getOrThrow, isEmpty, iteratorforEach, spliteratorforeachpublic R get()
Maybepublic boolean isDefined()
Maybepublic R on(Function<? super L,? extends R> f)
Either.Projectionpublic <X> Either<L,X> map(Function<? super R,X> f)
X - the RHS typef - The function to map across this projection.public <X,LL extends L> Either<L,X> flatMap(Function<? super R,Either<LL,X>> f)
X - the RHS typeLL - The existing LHS or a subtypef - The function to bind across this projection.public <X> Either<L,X> sequence(Either<L,X> e)
X - the RHS typee - The value to bind with.public <X> Option<Either<X,R>> filter(Predicate<? super R> f)
None if this projection has no value or if the given
predicate p does not hold for the value, otherwise, returns
a right in Some.X - the LHS typef - The predicate function to test on this projection's value.None if this projection has no value or if the given
predicate p does not hold for the value, otherwise, returns
a right in Some.public Either<L,R> filterOrElse(Predicate<? super R> p, Supplier<? extends L> orElseSupplier)
Right if this is a Right and the
contained values satisfies the given predicate.
If this is a Right but the predicate is not satisfied,
return a Left with the value provided by the orElseSupplier.
Return a Left if this a Left with the contained
value.p - The predicate function to test on the right contained value.orElseSupplier - The supplier to execute when is a right, and
predicate is unsatisfiedpublic <X> Either<L,X> ap(Either<L,Function<R,X>> either)
X - the RHS typeeither - The either of the function to apply on this projection's
value.@Deprecated public <X> Either<L,X> apply(Either<L,Function<R,X>> either)
X - the RHS typeeither - The either of the function to apply on this projection's
value.public final Iterator<A> iterator()
Maybeiterator in interface Maybe<A>iterator in interface Iterable<A>if
defined, or an empty one otherwise.public final Either<L,R> either()
Either.Projectioneither in interface Either.Projection<A,B,L,R>public final boolean isEmpty()
Maybepublic final Option<A> toOption()
Either.ProjectionSome if it exists,
otherwise None.toOption in interface Either.Projection<A,B,L,R>Some if it exists,
otherwise None.public final Optional<A> toOptional()
Either.ProjectionOptional.of(T) if it exists,
otherwise Optional.empty().toOptional in interface Either.Projection<A,B,L,R>of if it exists,
otherwise empty.public final Stream<A> toStream()
Either.ProjectionStream.of(T) if it exists,
otherwise Stream.empty().toStream in interface Either.Projection<A,B,L,R>of if it exists,
otherwise empty.public final boolean exists(Predicate<? super A> f)
Maybeis defined and
applying the predicate to the contained value returns true.public final A getOrNull()
MaybeAlthough the use of null is discouraged, code written to use these must often interface with code that expects and returns nulls.
public final boolean forall(Predicate<? super A> f)
Maybetrue if empty or the result of the
application of the given function to the value.public final A getOrError(Supplier<String> err)
Maybe
Used when absolutely sure this is defined.
getOrError in interface Maybe<A>err - the message for the error.public <X extends Throwable> A getOrThrow(Supplier<X> ifUndefined) throws X extends Throwable
Maybe
Used when absolutely sure this is defined.
getOrThrow in interface Maybe<A>X - exception typeifUndefined - the supplier of the throwable.X - the throwable the supplier creates if there is no value.X extends Throwablepublic final A getOr(Supplier<? extends A> a)
Maybeif defined or call the supplier and
return its value if not. Replaces Maybe.getOrElse(Supplier).
Get the value if defined or call the supplier and
return its value if not.@Deprecated public final A getOrElse(Supplier<? extends A> a)
Maybeif defined or call the supplier and
return its value if not.public final <X extends A> A getOrElse(X x)
Maybeother.getOrElse in interface Maybe<A>X - default value typex - value to return if this is emptyis defined, otherwise
returns other@Deprecated public final void foreach(Effect<? super A> f)
Effect.Applicantforeach in interface Effect.Applicant<A>f - the input to use for performing the effect.Copyright © 2018 Atlassian. All rights reserved.