boolean (@NotNull ExternalDependency seenDependency, @NotNull ExternalDependency nextDependency) { Collection<File> seenFiles = getFiles(seenDependency); Collection<File> nextFiles = getFiles(nextDependency); boolean filesSeen = seenFiles.containsAll(nextFiles); boolean projectDependencySeen = compareAsProjectDependencies(seenDependency, nextDependency); return filesSeen || projectDependencySeen; }