To solve this, we can push that method call into a closure and make the calls against that closure, instead. The resulting code is shown below.
为了解决此问题,我们可以把该方法调用放入闭包并转而针对该闭包执行调用。
A method or function can communicate with a closure by passing in arguments.
方法或函数可通过传入参数与闭包通信。
Because it is a Seq, it has a foreach method that takes a closure as a parameter.
因为它是一个Seq,它具有一个foreach方法,并将一个闭包作为参数。
应用推荐