File[] (String dirPath, final Pattern pattern) { File distDir = new File(dirPath); File[] files = distDir.listFiles((dir, name) -> pattern.matcher(name).matches()); return files != null ? files : new File[0]; }