Is there an idiomatic Scala solution to obtain only the file names from File.listFiles?
Perhaps something like:
val names = new File(dir).listFiles.somemagicTrait(_getName)
and have names become a List[String]?
I know I can just loop and add them to a mutable list.
I’m always wary of answering the wrong part of the question, but as Jean-Phillipe commented, you can get an array of the names from
and if you really need a list call
toListon that.