gmethvin / directory-watcher

A cross-platform Java recursive directory watcher, with a JNA macOS watcher and Scala better-files integration
Apache License 2.0
264 stars 34 forks source link

Use SortedMap for hash code map #63

Closed gmethvin closed 3 years ago

gmethvin commented 3 years ago

Use a ConcurrentSkipListMap to track file hashes instead of ConcurrentHashMap. Since the map is a SortedMap, we can easily remove entire subtrees when they are deleted without having to traverse the entire map. Other map operations are now logarithmic time rather than effectively constant time, but I think that's a reasonable tradeoff.