boolean ( @Nullable DataNode<ProjectData> ideProject, @NotNull final LibraryData library) { if (ideProject == null) return false; Map<String, DataNode<LibraryData>> cache = ideProject.getUserData(LIBRARIES_BY_NAME_CACHE); if (cache == null) { cache = new HashMap<>(); ideProject.putUserData(LIBRARIES_BY_NAME_CACHE, cache); } String libraryName = library.getExternalName(); DataNode<LibraryData> libraryData = cache.computeIfAbsent(libraryName, (String name) -> { DataNode<LibraryData> newValueToCache = ExternalSystemApiUtil.find(ideProject, ProjectKeys.LIBRARY, node -> libraryName.equals(node.getData().getExternalName())); if (newValueToCache == null) { newValueToCache = ideProject.createChild(ProjectKeys.LIBRARY, library); } return newValueToCache; }); return libraryData.getData().equals(library); }