ModuleOrderEntry (@NotNull ModuleDependencyData dependency, @NotNull Module module) { Map<String, List<ModuleOrderEntry>> namesToEntries = myIdeModuleToModuleDepsCache.computeIfAbsent( module, (m) -> Arrays.stream(getOrderEntries(m)) .filter(ModuleOrderEntry.class::isInstance) .map(ModuleOrderEntry.class::cast) .collect(Collectors.groupingBy(ModuleOrderEntry::getModuleName)) ); List<ModuleOrderEntry> candidates = namesToEntries.get(dependency.getInternalName()); if (candidates == null) { return null; } for (ModuleOrderEntry candidate : candidates) { if (candidate.getScope().equals(dependency.getScope())) { return candidate; } } return null; }