private void populateResults() {
        while (!depthStack.isEmpty() && resultQueue.isEmpty()) {
            DepthControl currentDepthControl = depthStack.pop();
            File currentFile = currentDepthControl.getFile();
            int currentDepth = currentDepthControl.getDepth();

            if (yieldFilter.apply(currentFile)) {
                if (currentFile.isDirectory() && dirFilter.apply(currentFile)) {
                    if (branchFilter.apply(currentFile) && currentDepth < maxDepth) {
                        File[] subFiles = currentFile.listFiles();
                        if (subFiles != null) {
                            for (File f : subFiles) {
                                depthStack.add(new DepthControl(currentDepth + 1, f));
                            }
                        }
                    }
                } else if (currentFile.isFile() && fileFilter.apply(currentFile)) {
                    resultQueue.offer(currentFile);
                }
            }
        }

    }
Fills the result queue by processing the files and directories from fileStack.
inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/utils/file/FileFinderIterator.java