List<Chunk<ModuleSourceSet>> (@NotNull Project project, @NotNull List<? extends Module> modules) { Collection<Chunk<ModuleSourceSet>> chunks = computeSourceSetCycles(new DefaultModulesProvider(project)); final Set<Module> modulesSet = new HashSet<>(modules); return ContainerUtil.filter(chunks, chunk -> { for (ModuleSourceSet sourceSet : chunk.getNodes()) { if (modulesSet.contains(sourceSet.getModule())) { return true; } } return false; }); }