Collection<ExternalDependency> (@NotNull Iterable<?> fileCollections, @NotNull String scope) { Set<ExternalDependency> result = new LinkedHashSet<>(); for (Object fileCollection : fileCollections) { if (fileCollection instanceof FileCollection) { result.addAll(getDependencies((FileCollection)fileCollection, scope)); } } return result; }