Aim is to get latest 100 files. Currently it is done by scanning all files - preparing a files list - and then apply sort+limit.
this is very slow - in cases when directory is too large. So is there any way or API available which does this without loading full file list.
Currently following three approaches do not give satisfactory performance when files are in range of few thousands.
- Files.listFiles - Java 1.2
- DirectoryStream - Java 1.7
- Files.Walk - Java 1.8