void () { List<PsiBreakStatement> breaks = collectBreaks(); Map<Boolean, List<PsiBreakStatement>> groups = StreamEx.of(breaks).partitioningBy(breakStatement -> isRemovable(mySwitchBlock, breakStatement)); List<PsiBreakStatement> removableBreaks = groups.get(true); removableBreaks.forEach(DeleteUnnecessaryStatementFix::deleteUnnecessaryStatement); List<PsiBreakStatement> replaceableBreaks = groups.get(false); if (!replaceableBreaks.isEmpty()) { assert myReplacement != null; for (PsiBreakStatement breakStatement : replaceableBreaks) { new CommentTracker().replaceAndRestoreComments(breakStatement, myReplacement); } } }