ExtremumTerminal (@NotNull PsiStatement thenBranch, @NotNull PsiExpression thenCondition, @NotNull PsiStatement elseBranch, @NotNull TerminalBlock terminalBlock, @Nullable List<? extends PsiVariable> nonFinalVariables) { PsiIfStatement elseIfStatement = tryCast(elseBranch, PsiIfStatement.class); if (elseIfStatement == null || elseIfStatement.getElseBranch() != null) return null; PsiExpression elseIfCondition = elseIfStatement.getCondition(); PsiStatement elseIf = ControlFlowUtils.stripBraces(elseIfStatement.getThenBranch()); if (elseIf == null || elseIfCondition == null) return null; ExtremumTerminal firstWay = extractIfElseCase(thenBranch, thenCondition, elseIf, elseIfCondition, terminalBlock, nonFinalVariables); if (firstWay != null) return firstWay; return extractIfElseCase(elseIf, elseIfCondition, thenBranch, thenCondition, terminalBlock, nonFinalVariables); }