public abstract static class Lang.F0<R> extends Lang.FuncBase implements Lang.Func0<R>
Default implementation for Lang.Func0. Implementation of Lang.Func0 should (nearly) always extend to this class instead of implement the interface directly
| Constructor and Description |
|---|
F0() |
| Modifier and Type | Method and Description |
|---|---|
Lang.F0<R> |
andThen(Lang.Func0<? extends R>... fs)
Returns a composed function that applied, in sequence, this function and all functions specified one by one.
|
<T> Lang.Producer<T> |
andThen(Lang.Function<? super R,? extends T> after)
Returns a composed function that applies this function to it’s input and then applies the
after function to the result. |
R |
applyOrElse(Lang.F0<? extends R> fallback)
Applies this partial function to the given argument when it is contained in the function domain.
|
Lang.F0<Lang.Option<R>> |
lift()
Turns this partial function into a plain function returning an Option result.
|
Lang.F0<R> |
orElse(Lang.Func0<? extends R> fallback)
Returns a composed function that when applied, try to apply this function first, in case a
RuntimeException is captured apply to the fallback function specified. |
breakOutclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitapplypublic R applyOrElse(Lang.F0<? extends R> fallback)
Applies this partial function to the given argument when it is contained in the function domain. Applies fallback function where this partial function is not defined, i.e. any RuntimeException is captured
fallback - if RuntimeException captured then apply this fallback functionpublic <T> Lang.Producer<T> andThen(Lang.Function<? super R,? extends T> after)
Returns a composed function that applies this function to it’s input and then applies the after function to the result. If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
T - the type of the output of the before functionafter - the function applies after this function is appliedNullPointerException - if before is nullpublic Lang.F0<R> andThen(Lang.Func0<? extends R>... fs)
Returns a composed function that applied, in sequence, this function and all functions specified one by one. If applying anyone of the functions throws an exception, it is relayed to the caller of the composed function. If an exception is thrown out, the following functions will not be applied.
When apply the composed function, the result of the last function is returned
fs - a sequence of function to be applied after this functionpublic Lang.F0<R> orElse(Lang.Func0<? extends R> fallback)
Returns a composed function that when applied, try to apply this function first, in case a RuntimeException is captured apply to the fallback function specified. This method helps to implement partial function
fallback - the function to applied if this function doesn’t apply in the current situationpublic Lang.F0<Lang.Option<R>> lift()
Turns this partial function into a plain function returning an Option result.
Copyright © 2014–2021 OSGL (Open Source General Library). All rights reserved.