Record Class Trampoline.FlatMap<A,B>
java.lang.Object
java.lang.Record
cloud.opencode.base.functional.monad.Trampoline.FlatMap<A,B>
- Type Parameters:
A- input type - 输入类型B- output type - 输出类型- Record Components:
previous- the previous computation - 之前的计算f- the transformation function - 转换函数
- All Implemented Interfaces:
Trampoline<B>
- Enclosing interface:
Trampoline<T>
public static record Trampoline.FlatMap<A,B> (Trampoline<A> previous, Function<? super A, Trampoline<B>> f)
extends Record
implements Trampoline<B>
FlatMapped Trampoline for chaining computations.
用于链接计算的 FlatMapped Trampoline。
- Since:
- JDK 25, opencode-base-functional V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Nested Class Summary
Nested classes/interfaces inherited from interface Trampoline
Trampoline.Done<T>, Trampoline.FlatMap<A,B>, Trampoline.More<T> -
Constructor Summary
ConstructorsConstructorDescriptionFlatMap(Trampoline<A> previous, Function<? super A, Trampoline<B>> f) Creates an instance of aFlatMaprecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Function<? super A, Trampoline<B>> f()Returns the value of thefrecord component.<U> Trampoline<U> flatMap(Function<? super B, Trampoline<U>> g) Chain another Trampoline computation.final inthashCode()Returns a hash code value for this object.booleanisDone()Check if the Trampoline is complete.previous()Returns the value of thepreviousrecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
isDone
public boolean isDone()Description copied from interface:TrampolineCheck if the Trampoline is complete. 检查 Trampoline 是否完成。- Specified by:
isDonein interfaceTrampoline<A>- Returns:
- true if done - 如果完成返回 true
-
flatMap
Description copied from interface:TrampolineChain another Trampoline computation. 链接另一个 Trampoline 计算。Enables composition of multiple trampolined computations.
启用多个蹦床计算的组合。
- Specified by:
flatMapin interfaceTrampoline<A>- Type Parameters:
U- result type - 结果类型- Parameters:
g- function producing the next Trampoline - 产生下一个 Trampoline 的函数- Returns:
- chained Trampoline
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
previous
-
f
-