void (@NotNull WatchSymlinkRequest request) { String watchRoot = request.getRootPath(); Map<String, List<WatchRequest>> roots = request.isToWatchRecursively() ? myRecursiveWatchRoots : myFlatWatchRoots; List<WatchRequest> requests = roots.computeIfAbsent(watchRoot, __ -> new SmartList<>()); requests.add(request); if (requests.size() == 1 && !WatchRootsUtil.isCoveredRecursively(myOptimizedRecursiveWatchRoots, watchRoot)) { if (request.isToWatchRecursively()) { WatchRootsUtil.insertRecursivePath(myOptimizedRecursiveWatchRoots, watchRoot); } } if (request.setRegistered(true)) { myWatcherRequiresUpdate = true; myPathMappings.add(new Pair<>(watchRoot, request.getOriginalPath())); } }