void (@NotNull List<? extends FileInfo> fileInfos, @Nullable String changelist) { FileInfo[] copy = fileInfos.toArray(new FileInfo[0]); MultiMap<HandleType, VirtualFile> handleTypeToFile = new MultiMap<>(); for (FileInfo fileInfo : copy) { handleTypeToFile.putValue(fileInfo.getSelectedHandleType(), fileInfo.getFile()); } for (HandleType handleType : handleTypeToFile.keySet()) { handleType.processFiles(handleTypeToFile.get(handleType), changelist); } for (FileInfo fileInfo : copy) { if (!fileInfo.getFile().exists() || fileInfo.getFile().isWritable()) { fileInfos.remove(fileInfo); } } }