你如何使这种方法的工作?斯卡拉foreach返回
def filled(b: Board): Board = {
b.next foreach { n =>
if (n.filled) n
else filled(n)
}
}
我需要先填写N(n.filled ==真)象Java后返回。
现在,我得到:
chess-knight.scala:72: error: type mismatch;
found : Unit
required: this.Board
b.next foreach { n =>
^
one error found
谢谢!
是什么类型'b.next'? –
对不起,b.next:列表[Board]。 – Etam