我想知道在什么情况下我可以实现cascading.operation.Buffer
、cascading.operation.Function
并对元组执行操作。
public class Hello extends BaseOperation implements Buffer, Function {
}
我不确定上面的类(class)是否有效。
如果有效那么会调用哪个操作方法?
我应该在哪些实际场景中实现它?有任何性能问题吗?
最佳答案
您正在谈论的接口(interface)是:
他们确实都有一个 operate()
方法,但这些方法具有不同的参数签名,更具体地说:
void operate(FlowProcess flowProcess,
<强>BufferCall<C>
bufferCall)
对于<强>Buffer
void operate(FlowProcess flowProcess,
<强>FunctionCall<C>
functionCall)
对于<强>Function
这两个接口(interface)的公共(public) super 接口(interface)(即 Operation<C>
)在 BaseOperation<C>
中使用。类与 operate()
无关方法,因为它仅在子接口(interface)中定义。
所以要回答哪个operate()
方法将被调用:
取决于传递给该方法的第二个参数的类型。
关于java - 在单个类中实现 Function 和 Buffer 是个好主意吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34582917/