You’ll notice that FileTree has a ‘getFiles()’ method that you can use to get a real collection that has all the Groovy methods.
The ‘each()’ method works out of the box because ‘FileTree’ implements ‘Iterable’, for which Groovy adds the ‘each()’ method. You could argue that ‘collectEntries()’ should be available to all 'Iterable’s, but that’s an argument for the Groovy language.