boolean (@NotNull Collection<?> c) { if (frozen) { throw new IllegalStateException(); } if (c instanceof CompactVirtualFileSet) { boolean modified = false; IntSet specifiedIdSet = ((CompactVirtualFileSet)c).idSet; BitSet specifiedFileIds = ((CompactVirtualFileSet)c).fileIds; Set<VirtualFile> specifiedWeirdFiles = ((CompactVirtualFileSet)c).weirdFiles; if (idSet != null) { IntList toRemove = new IntArrayList(); IntIterator iterator = idSet.intIterator(); while (iterator.hasNext()) { int id = iterator.nextInt(); if (!contains(id, specifiedIdSet, specifiedFileIds, specifiedWeirdFiles)) { toRemove.add(id); modified = true; } } toRemove.forEach(i -> { idSet.remove(i); }); } if (fileIds != null) { for (int id : fileIds.stream().toArray()) { if (!contains(id, specifiedIdSet, specifiedFileIds, specifiedWeirdFiles)) { fileIds.set(id, false); modified = true; } } } Iterator<VirtualFile> it = weirdFiles.iterator(); while (it.hasNext()) { VirtualFile file = it.next(); if (!c.contains(file)) { it.remove(); modified = true; } } return modified; } else { return super.retainAll(c); } }