public static class LazyEither.Right<ST,PT> extends java.lang.Object implements LazyEither<ST,PT>
LazyEither.CompletableEither<ORG,RT>, LazyEither.Lazy<ST,PT>, LazyEither.Left<ST,PT>, LazyEither.Right<ST,PT>
Constructor and Description |
---|
Right() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
Maybe<PT> |
filter(java.util.function.Predicate<? super PT> test)
Keep only elements for which the supplied predicates hold
e.g.
|
<RT1> LazyEither<ST,RT1> |
flatMap(java.util.function.Function<? super PT,? extends Either<? extends ST,? extends RT1>> mapper) |
<LT1> LazyEither<LT1,PT> |
flatMapLeft(java.util.function.Function<? super ST,? extends Either<LT1,PT>> mapper)
Perform a flatMap operation on the Left type
|
LazyEither<ST,PT> |
flatMapLeftToRight(java.util.function.Function<? super ST,? extends Either<ST,PT>> fn)
A flatMap operation that keeps the Left and Right types the same
|
<R> R |
fold(java.util.function.Function<? super PT,? extends R> present,
java.util.function.Supplier<? extends R> absent) |
<R> R |
fold(java.util.function.Function<? super ST,? extends R> secondary,
java.util.function.Function<? super PT,? extends R> primary)
Visitor pattern for this Ior.
|
Option<PT> |
get() |
Option<ST> |
getLeft() |
int |
hashCode() |
boolean |
isLeft() |
boolean |
isRight() |
ST |
leftOrElse(ST alt) |
ReactiveSeq<ST> |
leftToStream() |
<R> LazyEither<ST,R> |
map(java.util.function.Function<? super PT,? extends R> fn)
Transform this functor using the supplied transformation function
|
<R> LazyEither<R,PT> |
mapLeft(java.util.function.Function<? super ST,? extends R> fn)
Always transform the Left type of this Either if it is present using the provided transformation function
|
LazyEither<ST,PT> |
mapLeftToRight(java.util.function.Function<? super ST,? extends PT> fn)
If this Either contains the Left type, transform it's value so that it contains the Right type
|
java.lang.String |
mkString()
Returns the class name and the name of the subclass, if there is any value, the value is showed between square brackets.
|
LazyEither<ST,PT> |
peek(java.util.function.Consumer<? super PT> action)
Peek at the current value of this Transformable, without transforming it
|
LazyEither<ST,PT> |
peekLeft(java.util.function.Consumer<? super ST> action)
Peek at the Left type value if present
|
Either<ST,PT> |
recover(PT value) |
Either<ST,PT> |
recover(java.util.function.Supplier<? extends PT> value) |
Either<ST,PT> |
recoverWith(java.util.function.Supplier<? extends Either<ST,PT>> fn) |
LazyEither<PT,ST> |
swap()
Swap types so operations directly affect the current (pre-swap) Left type
|
Ior<ST,PT> |
toIor() |
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
accumulate, applyAny, arity, async, bimap, bipeek, combine, combine, combineToLazySeq, combineToList, consumeAny, either, filter, forEach2, forEach3, forEach4, fromEither, fromFuture, fromIterable, fromLazy, fromPublisher, isPresent, lazySeq, left, leftEval, narrow, narrowK, narrowK2, nest, right, rightEval, sequence, sequenceLeft, sequenceRight, tailRec, toEither, toEither, toEitherTrampoline, toTrampoline, toTrampoline, toTrampoline, traverse, traverseLeft, traverseRight, unit, visitAny, visitAny, zip, zip
accumulateLeft, accumulateLeft, accumulateLeft, accumulateRight, accumulateRight, accumulateRight, applyAny, combineToVector, consumeAny, filterNot, fromIterable, nestedEval, notNull, ofType, sequence, sequenceLeft, sequenceRight, tailRec, traverse, visitAny, visitAny, widen
orElseUse, orElseUse
asSupplier, collect, fold, forEach, generate, iterate, iterator, newSubscriber, nonEmptyList, nonEmptyListGet, orElse, orElseGet, print, print, printErr, printOut, stream, subscribe, toLazyEither, toLeft, toMaybe, toOption, toOptional, toRight, toTry, toTry, toTry, transform
public Either<ST,PT> recoverWith(java.util.function.Supplier<? extends Either<ST,PT>> fn)
recoverWith
in interface Either<ST,PT>
public LazyEither<ST,PT> mapLeftToRight(java.util.function.Function<? super ST,? extends PT> fn)
LazyEither
mapLeftToRight
in interface Either<ST,PT>
mapLeftToRight
in interface LazyEither<ST,PT>
fn
- Function to transform left type to rightpublic <R> LazyEither<R,PT> mapLeft(java.util.function.Function<? super ST,? extends R> fn)
LazyEither
public <R> LazyEither<ST,R> map(java.util.function.Function<? super PT,? extends R> fn)
Transformable
of(1,2,3).map(i->i*2)
//[2,4,6]
public LazyEither<ST,PT> peekLeft(java.util.function.Consumer<? super ST> action)
LazyEither
public LazyEither<ST,PT> peek(java.util.function.Consumer<? super PT> action)
Transformable
of(1,2,3).map(System.out::println)
1
2
3
public Maybe<PT> filter(java.util.function.Predicate<? super PT> test)
Filters
of(1,2,3).filter(i->i>2);
//[3]
public LazyEither<PT,ST> swap()
LazyEither
Either.left("hello")
.map(v->v+" world")
//Either.seconary["hello"]
Either.left("hello")
.swap()
.map(v->v+" world")
.swap()
//Either.seconary["hello world"]
public ReactiveSeq<ST> leftToStream()
leftToStream
in interface Either<ST,PT>
leftToStream
in interface LazyEither<ST,PT>
public <RT1> LazyEither<ST,RT1> flatMap(java.util.function.Function<? super PT,? extends Either<? extends ST,? extends RT1>> mapper)
public <LT1> LazyEither<LT1,PT> flatMapLeft(java.util.function.Function<? super ST,? extends Either<LT1,PT>> mapper)
LazyEither
flatMapLeft
in interface Either<ST,PT>
flatMapLeft
in interface LazyEither<ST,PT>
mapper
- Flattening transformation functionpublic LazyEither<ST,PT> flatMapLeftToRight(java.util.function.Function<? super ST,? extends Either<ST,PT>> fn)
LazyEither
flatMapLeftToRight
in interface Either<ST,PT>
flatMapLeftToRight
in interface LazyEither<ST,PT>
fn
- Transformation functionpublic boolean isRight()
public boolean isLeft()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String mkString()
Value
public <R> R fold(java.util.function.Function<? super ST,? extends R> secondary, java.util.function.Function<? super PT,? extends R> primary)
LazyEither
Either.right(10)
.visit(left->"no", right->"yes")
//Either["yes"]
Either.left(90)
.visit(left->"no", right->"yes")
//Either["no"]
fold
in interface Sealed2<ST,PT>
fold
in interface Either<ST,PT>
fold
in interface LazyEither<ST,PT>
secondary
- Function to execute if this is a Left Eitherprimary
- Function to execute if this is a Right Iorpublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object