FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 324 Ask New Question


How can i filter files with particular extension in Java, let say i want to filter all .json files from a folder.

On By


1 Answer


Following code filters all json files from the flder /path/to/folder

Arrays.asList(Paths.get("/path/to/folder").toFile().listFiles(file -> !file.isHidden() &&  file.isFile() && (file.getName().endsWith(".json")))).forEach(file -> {
    // deal with the file
});
On By


Answer This Question


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News