Use visitor when snapshotting FileCollections In many places when resolving and walking nested file collections we collect files into Sets. This is expensive because we have to de-duplicate the files. In many cases de-duplication doesn't need to happen, or it can happen only on the top level. In these cases visiting instead of collecting is a much better alternative.
This commit is a first step towards using more visitors. It introduces FileCollectionInternal.visitContents(Consumer<File>) and uses it in file snapshotting.