class RecursiveFileIterator implements Iterator<File> {

        private final File[] subDirs;
        private int subDirIndex = -1;

        private File[] files = null;
        private int fileIndex = -1;

        private RecursiveFileIterator(File[] subDirs) {
            this.subDirs = subDirs;
        }

        /**
         * Returns {@code true} if the current sub-directory have files to traverse. Otherwise, iterates
         * until it finds the next sub-directory with files inside it.
         * Returns {@code false} only after reaching the last file of the last sub-directory.
         */
        @Override
        public boolean hasNext() {<FILL_FUNCTION_BODY>}

        @Override
        public File next() {
            if (hasNext()) {
                return files[++fileIndex];
            }

            throw new NoSuchElementException("List of files is empty");
        }

        @Override
        public void remove() {
            throw new UnsupportedOperationException("remove is unsupported for " + BlobContainer.class.getSimpleName());
        }
    }

            if (files == null || (fileIndex + 1) == files.length) {
                files = null;
                fileIndex = -1;
                while (subDirIndex + 1 < subDirs.length && (files == null || files.length == 0)) {
                    files = subDirs[++subDirIndex].listFiles();
                }
            }
            return (files != null && fileIndex + 1 < files.length);
        
<no_super_class>