void (@NotNull SwitchStatement switchStatement, @NotNull PatternContainer patternContainer) { for (int i = 0; i < switchStatement.getCaseStatements().size(); i++) { Statement currentCaseStatement = switchStatement.getCaseStatements().get(i); List<PatternContainer.PatternStatement> patterns = patternContainer.getPatterns(currentCaseStatement); if (patterns != null && patterns.size() == 1) { Statement newStatement = patterns.get(0).caseStatement(); switchStatement.replaceStatement(switchStatement.getCaseStatements().get(i), newStatement); switchStatement.getCaseStatements().set(i, newStatement); switchStatement.getCaseEdges().get(i).forEach(edge -> { edge.setDestination(patterns.get(0).caseStatement()); } ); Exprent guard = patterns.get(0).guard(); if (guard != null) { switchStatement.addGuard(switchStatement.getCaseStatements().get(i), guard); } } } }