DFAMap<ScopeVariable> (@NotNull List<DFAMap<ScopeVariable>> ins) { if (ins.isEmpty()) { return DFAMap.empty(); } if (ins.size() == 1) { return ins.get(0); } final Set<String> resultNames = getResultNames(ins); if (resultNames == null || resultNames.isEmpty()) { return new DFAMap<>(); } final DFAMap<ScopeVariable> result = new DFAMap<>(); for (String name : resultNames) { boolean isParameter = true; Set<PsiElement> declarations = new HashSet<>(); // iterating over all maps for (DFAMap<ScopeVariable> map : ins) { final ScopeVariable variable = map.get(name); if (variable == null) { continue; } isParameter = isParameter && variable.isParameter(); declarations.addAll(variable.getDeclarations()); } final ScopeVariable scopeVariable = new ScopeVariableImpl(name, isParameter, declarations); result.put(name, scopeVariable); } return result; }