Package jsonvalues
Interface Trampoline<T>
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Trampoline<T>
bounce()
default boolean
complete()
static <T> Trampoline<T>
done(T result)
default <R> Trampoline<R>
flatMap(Function<? super T,? extends Trampoline<R>> fn)
map this trampoline which returns a T, into another one that returns a R.T
get()
Gets a resultdefault <R> Trampoline<R>
map(Function<? super T,? extends R> fn)
maps this trampoline which returns a T, into another one that returns a R.static <T> Trampoline<T>
more(Trampoline<Trampoline<T>> trampoline)
-
-
-
Method Detail
-
done
static <T> Trampoline<T> done(T result)
-
more
static <T> Trampoline<T> more(Trampoline<Trampoline<T>> trampoline)
-
map
default <R> Trampoline<R> map(Function<? super T,? extends R> fn)
maps this trampoline which returns a T, into another one that returns a R. When the method get() is invoked, this trampoline is executed and then the result is mapped.- Type Parameters:
R
- type of the result- Parameters:
fn
- the map function, from T to R- Returns:
- a Trampoline of type R
-
flatMap
default <R> Trampoline<R> flatMap(Function<? super T,? extends Trampoline<R>> fn)
map this trampoline which returns a T, into another one that returns a R. When the method get() is invoked, this trampoline is executed and then the result of type T is passed to the trampoline specified in the flatMap function, which will return a R. So, two trampolines are executed, one after the other.- Type Parameters:
R
- type of the result- Parameters:
fn
- the map function, from T toTrampoline<R>
- Returns:
- a Trampoline of type R
-
bounce
default Trampoline<T> bounce()
- Returns:
- next stage
-
complete
default boolean complete()
-
-