Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- @author : Aamir khan
- @url : chapter09.blogspot.in
- Sort Files by type and then by names and vice versa
- **/
- private static Comparator SortByFileTypeThenByName() {
- return Comparator.comparing((File f) -> {
- String probeContentType = null;
- try {
- probeContentType = Files.probeContentType(f.toPath());
- if (probeContentType == null) {
- probeContentType = "probeContentTypeIsNull";
- }
- } catch (IOException e) {}
- return probeContentType;
- }).thenComparing(File::getName);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement