private void listArchive ( Archive archive , RelativeDirectory subdirectory , Set < JavaFileObject . Kind > fileKinds , boolean recurse , ListBuffer < JavaFileObject > resultList ) { // Get the files directly in the subdir List < String > files = archive . getFiles ( subdirectory ) ; if ( files != null ) { for ( ; ! files . isEmpty ( ) ; files = files . tail ) { String file = files . head ; if ( isValidFile ( file , fileKinds ) ) { resultList . append ( archive . getFileObject ( subdirectory , file ) ) ; } } } if ( recurse ) { for ( RelativeDirectory s : archive . getSubdirectories ( ) ) { if ( subdirectory . contains ( s ) ) { // Because the archive map is a flat list of directories, // the enclosing loop will pick up all child subdirectories. // Therefore, there is no need to recurse deeper. listArchive ( archive , s , fileKinds , false , resultList ) ; } } } }
Insert all files in subdirectory subdirectory of archive archive which match fileKinds into resultList