void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { PsiMethodCallExpression methodCallExpression = PsiTreeUtil.getParentOfType(element, PsiMethodCallExpression.class); if(methodCallExpression != null) { PsiExpression[] args = methodCallExpression.getArgumentList().getExpressions(); if(args.length == 2) { PsiExpression list = args[0]; PsiExpression comparator = args[1]; String replacement = ParenthesesUtils.getText(list, ParenthesesUtils.POSTFIX_PRECEDENCE) + ".sort(" + comparator.getText() + ")"; methodCallExpression .replace(JavaPsiFacade.getElementFactory(project).createExpressionFromText(replacement, methodCallExpression)); } } }