I have a directory of files that I need to check for changes. I consider it changed when one of the files has a modifiedDate
newer than what I remembered from the last check (this is meant to be a cache dependency).
What would be the fastest way of finding the latest modified file in a directory in Java?
Maybe I'm too optimistic, but I'm explicitly looking for something that does not involve iterating all the files.
Also, checking the directory modified date is not enough, as this only changes when the list of files inside changes, not when one of the files themselves is just modified.