Scala style: for vs foreach, filter, map and others
问题 What is the best style in scala for "advanced iteration" over collection of smth. In which cases I should use for-comprehension and when I should look for alternative way(in terms of style) of iteration. In Programming in Scala book there is an example that looks almost as next one: for{ file <- filesHere if file.getName.endsWith("txt") line <- Source.fromFile(file).getLines.toList if line.trim.matches(pattern) } println("|" + file + ": " + line.trim) I've tried to rewrite it using internal