一些文章建议
现在 build()
包含在 perform()
本身中,而其他人则建议
当要链接多个操作时使用 build().perform()
一起。
最佳答案
build()
包含在 perform()
中,您可以在 source code 中看到它。
public void perform() {
build().perform();
}
方法内的perform()
调用内部类BuiltAction
中的perform()
方法。
在代码中调用 build().perform()
实际上是调用 build()
两次, build().build().perform()
.
Generates a composite action containing all actions so far, ready to be performed (and resets the internal builder state, so subsequent calls to build() will contain fresh sequences).
A convenience method for performing the actions without calling build() first.
这几乎没有误导性(IMO),因为正在调用 build()
,即使是隐式调用。
关于java - build().perform() 和 Perform() 之间有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54053633/