I\'m coding against an API that gives me access to remote file system. The API returns a list of files and directories as list of node objects (parent to file and directory)
What you want to do is essentially: iterate over all elements of workarea.getChildren() that are of type CSDir (in other words: matching some criteria). Ordinary loop/for comprehension iterates over all elements. You cannot say: iterate over all elements having this type and skip others. You must be more explicit.
What do you think about:
workarea.getChildren() collect {case dir: CSDir => dir} foreach println
It does exactly what you want: collect all elements of workarea.getChildren() and for each of them call println.