@@ -0,0 +1,2335 @@
+package ru.job4j.io;%0A%0Aimport java.io.File;%0Aimport java.io.IOException;%0Aimport java.util.*;%0Aimport java.util.regex.Pattern;%0A%0A/**%0A * Class SearchFiles.%0A *%0A * @author Ponkin Aleksey%0A * @version 1.0.0%0A * @since 28.01.2019.%0A */%0Apublic class SearchFiles %7B%0A    /**%0A     * The queue for folder.%0A     */%0A    private final Queue%3CFile%3E queueFolders = new LinkedList%3C%3E();%0A    /**%0A     * The list of found files.%0A     */%0A    private final List%3CFile%3E findFiles = new ArrayList%3C%3E();%0A    /**%0A     * Pattern regExp extension.%0A     */%0A    private Pattern extsPatern;%0A%0A    /**%0A     * Get list files with extension.%0A     * @param parent path.%0A     * @param exts extension for searching.%0A     * @return list files.%0A     */%0A    public List%3CFile%3E files(String parent, List%3CString%3E exts) throws IOException %7B%0A        this.extsPatern = getPatternExt(exts);%0A        this.findFiles.clear();%0A        File parentFile = new File(parent);%0A        findFiles(parentFile);%0A        return this.findFiles;%0A    %7D%0A%0A    /**%0A     * Find files.%0A     * @param file file for check.%0A     * @throws IOException%0A     */%0A    private void findFiles(File file) throws IOException %7B%0A        if (file.isDirectory()) %7B%0A            this.queueFolders.offer(file);%0A            findInFolder();%0A        %7D else %7B%0A            checkExt(file);%0A        %7D%0A    %7D%0A%0A    /**%0A     * Find all file in folder end sub folder.%0A     */%0A    private void findInFolder() throws IOException %7B%0A        while (!this.queueFolders.isEmpty()) %7B%0A            File%5B%5D listFiles = this.queueFolders.poll().listFiles();%0A            for (File file : listFiles) %7B%0A                findFiles(file);%0A            %7D%0A        %7D%0A    %7D%0A%0A    /**%0A     * Check extension file and add if matches extension.%0A     * @param file for checking.%0A     */%0A    private void checkExt(File file) %7B%0A        if (extsPatern.matcher(file.getName()).matches()) %7B%0A            this.findFiles.add(file);%0A        %7D%0A    %7D%0A%0A    /**%0A     * Get patter for check extension.%0A     * @param exts list extension file.%0A     * @return pattern for check.%0A     */%0A    private Pattern getPatternExt(List%3CString%3E exts) %7B%0A        StringBuilder extsString = new StringBuilder(%22%5C%5Cw*%5C%5C.(%22);%0A        for (String ext : exts) %7B%0A            extsString.append(ext).append(%22%7C%22);%0A        %7D%0A        extsString.append(%22)%22);%0A        return Pattern.compile(extsString.toString());%0A    %7D%0A%7D

Add class SearchFiles.