public static final class LazyEither.Lazy<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 |
---|
Lazy() |
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.
|
LazyEither<ST,PT> |
filter(java.util.function.Predicate<? super PT> test,
java.util.function.Function<? super PT,? extends ST> rightToLeft) |
<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() |
java.util.Iterator<PT> |
iterator() |
ST |
leftOrElse(ST alt) |
ReactiveSeq<ST> |
leftToStream() |
<R> LazyEither<ST,R> |
map(java.util.function.Function<? super PT,? extends R> mapper)
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
|
Eval<Either<ST,PT>> |
nestedEval() |
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<ST,PT> |
resolve() |
void |
subscribe(org.reactivestreams.Subscriber<? super PT> sub) |
LazyEither<PT,ST> |
swap()
Swap types so operations directly affect the current (pre-swap) Left type
|
Trampoline<LazyEither<ST,PT>> |
toEitherTrampoline() |
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, forEach2, forEach3, forEach4, fromEither, fromFuture, fromIterable, fromLazy, fromPublisher, isPresent, lazySeq, left, leftEval, narrow, narrowK, narrowK2, nest, right, rightEval, sequence, sequenceLeft, sequenceRight, tailRec, toEither, toEither, toTrampoline, toTrampoline, toTrampoline, traverse, traverseLeft, traverseRight, unit, visitAny, visitAny, zip, zip
accumulateLeft, accumulateLeft, accumulateLeft, accumulateRight, accumulateRight, accumulateRight, applyAny, combineToVector, consumeAny, filterNot, fromIterable, notNull, ofType, sequence, sequenceLeft, sequenceRight, tailRec, traverse, visitAny, visitAny, widen
orElseUse, orElseUse
asSupplier, collect, fold, forEach, generate, iterate, mkString, newSubscriber, nonEmptyList, nonEmptyListGet, orElse, orElseGet, print, print, printErr, printOut, stream, 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 Eval<Either<ST,PT>> nestedEval()
nestedEval
in interface Either<ST,PT>
public Trampoline<LazyEither<ST,PT>> toEitherTrampoline()
toEitherTrampoline
in interface LazyEither<ST,PT>
public java.util.Iterator<PT> iterator()
public LazyEither<ST,PT> resolve()
public <R> LazyEither<ST,R> map(java.util.function.Function<? super PT,? extends R> mapper)
Transformable
of(1,2,3).map(i->i*2)
//[2,4,6]
public <RT1> LazyEither<ST,RT1> flatMap(java.util.function.Function<? super PT,? extends Either<? extends ST,? extends RT1>> mapper)
public final void subscribe(org.reactivestreams.Subscriber<? super PT> sub)
public Maybe<PT> filter(java.util.function.Predicate<? super PT> test)
Filters
of(1,2,3).filter(i->i>2);
//[3]
public LazyEither<ST,PT> filter(java.util.function.Predicate<? super PT> test, java.util.function.Function<? super PT,? extends ST> rightToLeft)
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 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 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 <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 ReactiveSeq<ST> leftToStream()
leftToStream
in interface Either<ST,PT>
leftToStream
in interface LazyEither<ST,PT>
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 int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object