boolean (PsiStatement @NotNull [] elseBranch, int elseLen, List<ExtractionUnit> headCommonParts, List<PsiStatement> tailCommonParts, Map<PsiLocalVariable, String> substitutionTable) { if (!substitutionTable.isEmpty()) { int firstTailCommonStatementIndex = elseLen - tailCommonParts.size(); HashSet<String> names = new HashSet<>(substitutionTable.values()); for (int i = headCommonParts.size(); i < firstTailCommonStatementIndex; i++) { if (StreamEx.ofTree((PsiElement)elseBranch[i], e -> StreamEx.of(e.getChildren())) .select(PsiVariable.class) .filter(var -> var instanceof PsiLocalVariable || var instanceof PsiParameter) .anyMatch(var -> names.contains(var.getName()))) { return true; } } } return false; }