void () { Set<VirtualFile> toRefresh = new HashSet<>(myRootsToRefresh); myRootsToRefresh.removeAll(toRefresh); // clear the set, but keep roots which could possibly arrive after collecting them in the var. myLogData.refresh(toRefresh); }