public static final class Either.Lazy<ST,PT> extends java.lang.Object implements Either<ST,PT>
Either.Lazy<ST,PT>, Either.Left<ST,PT>, Either.Right<ST,PT>
com.aol.cyclops.control.Xor.Primary<ST,PT>, com.aol.cyclops.control.Xor.Secondary<ST,PT>
com.aol.cyclops.types.applicative.ApplicativeFunctor.Applicatives, com.aol.cyclops.types.applicative.ApplicativeFunctor.ApplyFunctions<T>
Constructor and Description |
---|
Lazy() |
Modifier and Type | Method and Description |
---|---|
<T2,R> Either<ST,R> |
combine(com.aol.cyclops.types.Value<? extends T2> app,
java.util.function.BiFunction<? super PT,? super T2,? extends R> fn) |
boolean |
equals(java.lang.Object obj) |
Either<ST,PT> |
filter(java.util.function.Predicate<? super PT> test) |
<RT1> Either<ST,RT1> |
flatMap(java.util.function.Function<? super PT,? extends com.aol.cyclops.types.MonadicValue<? extends RT1>> mapper) |
PT |
get() |
int |
hashCode() |
boolean |
isLeft() |
boolean |
isRight() |
<R> Either<ST,R> |
map(java.util.function.Function<? super PT,? extends R> mapper) |
<R> com.aol.cyclops.control.Eval<R> |
matches(java.util.function.Function<com.aol.cyclops.control.Matchable.CheckValue1<ST,R>,com.aol.cyclops.control.Matchable.CheckValue1<ST,R>> fn1,
java.util.function.Function<com.aol.cyclops.control.Matchable.CheckValue1<PT,R>,com.aol.cyclops.control.Matchable.CheckValue1<PT,R>> fn2,
java.util.function.Supplier<? extends R> otherwise)
Pattern match on the value/s inside this Either.
|
Either<ST,PT> |
peek(java.util.function.Consumer<? super PT> action) |
void |
peek(java.util.function.Consumer<? super ST> stAction,
java.util.function.Consumer<? super PT> ptAction) |
Either<ST,PT> |
resolve() |
<LT1> Either<LT1,PT> |
secondaryFlatMap(java.util.function.Function<? super ST,? extends com.aol.cyclops.control.Xor<LT1,PT>> mapper)
Perform a flatMap operation on the Left type
|
ST |
secondaryGet() |
<R> Either<R,PT> |
secondaryMap(java.util.function.Function<? super ST,? extends R> fn)
Always map the Left type of this Either if it is present using the provided transformation function
|
Either<ST,PT> |
secondaryPeek(java.util.function.Consumer<? super ST> action)
Peek at the Left type value if present
|
java.util.Optional<ST> |
secondaryToOptional() |
Either<ST,PT> |
secondaryToPrimayFlatMap(java.util.function.Function<? super ST,? extends com.aol.cyclops.control.Xor<ST,PT>> fn)
A flatMap operation that keeps the Left and Right types the same
|
Either<ST,PT> |
secondaryToPrimayMap(java.util.function.Function<? super ST,? extends PT> fn)
If this Either contains the Left type, map it's value so that it contains the Right type
|
com.aol.cyclops.control.ReactiveSeq<ST> |
secondaryToStream() |
com.aol.cyclops.types.Value<ST> |
secondaryValue() |
Either<PT,ST> |
swap()
Swap types so operations directly affect the current (pre-swap) Left type
|
com.aol.cyclops.control.Ior<ST,PT> |
toIor() |
java.lang.String |
toString() |
<R> R |
visit(java.util.function.Function<? super ST,? extends R> secondary,
java.util.function.Function<? super PT,? extends R> primary)
Visitor pattern for this Ior.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
accumulate, anyM, anyM, anyMList, applyAny, bicast, bimap, bipeek, bitrampoline, cast, coflatMap, combine, combine, combine, combineEager, combineToList, combineToList, consumeAny, filterNot, flatMapIterable, flatMapPublisher, forEach2, forEach2, forEach3, forEach3, forEach4, forEach4, fromIterable, fromMonadicValue, fromPublisher, isPresent, isPrimary, isSecondary, left, leftEval, list, mapBoth, narrow, nest, notNull, ofType, patternMatch, right, rightEval, sequence, toOptional, toXor, toXor, trampoline, traverse, unit, visitAny, visitAny, zip, zip, zip, zip, zip, zip, zip
accumulatePrimary, accumulatePrimary, accumulatePrimary, accumulateSecondary, accumulateSecondary, accumulateSecondary, primary, secondary, sequencePrimary, sequenceSecondary
applyFunctions
collect, fold, fold, generate, iterate, iterator, mapReduce, mkString, newSubscriber, of, stream, subscribe, test, toDequeX, toEvalAlways, toEvalLater, toEvalNow, toFeatureToggle, toFutureStream, toFutureStream, toLazyImmutable, toList, toListX, toMaybe, toMutable, toPBagX, toPOrderedSetX, toPQueueX, toPSetX, toPStackX, toPVectorX, toQueueX, toSetX, toSimpleReact, toSimpleReact, toSortedSetX, toTry, toTry, toTry, unapply
endsWith, endsWithIterable, findAny, findFirst, firstValue, foldable, foldRight, foldRight, foldRight, foldRightMapToType, get, groupBy, join, join, join, mapReduce, print, print, printErr, printOut, reduce, reduce, reduce, reduce, reduce, reduce, reduce, schedule, scheduleFixedDelay, scheduleFixedRate, single, single, singleOptional, startsWith, startsWithIterable, toConcurrentLazyCollection, toConcurrentLazyStreamable, toLazyCollection, validate, xMatch
public <R> Either<ST,R> map(java.util.function.Function<? super PT,? extends R> mapper)
map
in interface com.aol.cyclops.control.Xor<ST,PT>
map
in interface Either<ST,PT>
map
in interface com.aol.cyclops.types.ConvertableFunctor<PT>
map
in interface com.aol.cyclops.types.Functor<PT>
map
in interface com.aol.cyclops.types.MonadicValue<PT>
public <RT1> Either<ST,RT1> flatMap(java.util.function.Function<? super PT,? extends com.aol.cyclops.types.MonadicValue<? extends RT1>> mapper)
public com.aol.cyclops.types.Value<ST> secondaryValue()
public Either<ST,PT> secondaryToPrimayMap(java.util.function.Function<? super ST,? extends PT> fn)
Either
public <R> Either<R,PT> secondaryMap(java.util.function.Function<? super ST,? extends R> fn)
Either
public Either<ST,PT> secondaryPeek(java.util.function.Consumer<? super ST> action)
Either
public Either<PT,ST> swap()
Either
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 visit(java.util.function.Function<? super ST,? extends R> secondary, java.util.function.Function<? super PT,? extends R> primary)
Either
Either.right(10)
.visit(secondary->"no", primary->"yes")
//Either["yes"]
Either.left(90)
.visit(secondary->"no", primary->"yes")
//Either["no"]
public PT get()
public ST secondaryGet()
public java.util.Optional<ST> secondaryToOptional()
public com.aol.cyclops.control.ReactiveSeq<ST> secondaryToStream()
public <LT1> Either<LT1,PT> secondaryFlatMap(java.util.function.Function<? super ST,? extends com.aol.cyclops.control.Xor<LT1,PT>> mapper)
Either
secondaryFlatMap
in interface com.aol.cyclops.control.Xor<ST,PT>
secondaryFlatMap
in interface Either<ST,PT>
mapper
- Flattening transformation functionpublic Either<ST,PT> secondaryToPrimayFlatMap(java.util.function.Function<? super ST,? extends com.aol.cyclops.control.Xor<ST,PT>> fn)
Either
public void peek(java.util.function.Consumer<? super ST> stAction, java.util.function.Consumer<? super PT> ptAction)
public boolean isRight()
public boolean isLeft()
public <T2,R> Either<ST,R> combine(com.aol.cyclops.types.Value<? extends T2> app, java.util.function.BiFunction<? super PT,? super T2,? extends R> fn)
public <R> com.aol.cyclops.control.Eval<R> matches(java.util.function.Function<com.aol.cyclops.control.Matchable.CheckValue1<ST,R>,com.aol.cyclops.control.Matchable.CheckValue1<ST,R>> fn1, java.util.function.Function<com.aol.cyclops.control.Matchable.CheckValue1<PT,R>,com.aol.cyclops.control.Matchable.CheckValue1<PT,R>> fn2, java.util.function.Supplier<? extends R> otherwise)
Either
import static com.aol.cyclops.control.Matchable.otherwise;
import static com.aol.cyclops.control.Matchable.then;
import static com.aol.cyclops.control.Matchable.when;
import static com.aol.cyclops.util.function.Predicates.instanceOf;
Either.right(10)
.matches(c->c.is(when("10"),then("hello")),
c->c.is(when(instanceOf(Integer.class)), then("error")),
otherwise("miss"))
.get()
//"error" Note the second case, 'primary' case is the one that matches
matches
in interface com.aol.cyclops.control.Xor<ST,PT>
matches
in interface Either<ST,PT>
fn1
- Pattern matching function executed if this Either has the secondary typefn2
- Pattern matching function executed if this Either has the primary typeotherwise
- Supplier used to provide a value if the selecting pattern matching function fails to find a matchpublic 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