JBIterable<VirtualFile> (@NotNull JBIterable<Object> userObjects) { return userObjects.map(entry -> { if (entry instanceof Change) { FilePath path = ChangesUtil.getAfterPath((Change)entry); return path != null ? path.getVirtualFile() : null; } else if (entry instanceof VirtualFile) { return (VirtualFile)entry; } else if (entry instanceof FilePath) { return ((FilePath)entry).getVirtualFile(); } return null; }) .filterNotNull() .filter(VirtualFile::isValid); }