Case this works:
Seq(fromDir, toDir) find (!_.isDirectory) foreach (println(_))
Whereas this doesn't:
Seq(fromDir, toDir) find (!_.isDirectory) foreach (throw new Exception(_.toString))
Compilation ends with this error:
error: missing parameter type for expanded function ((x$4) => x$4.toString)
Now if I write it this way it compiles again:
Seq(fromDir, toDir) find (!_.isDirectory) foreach (s => throw new Exception(s.toString))
I am sure there is a reasonable explanation ;)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…