void (@NotNull PsiMethodCallExpression call) { if (THEN_COMPARING_COMPARATOR.test(call)) { checkThenComparing(call); } if (COMPARATOR_COMPARING.test(call)) { PsiExpression arg = call.getArgumentList().getExpressions()[0]; PsiElement nameElement = Objects.requireNonNull(call.getMethodExpression().getReferenceNameElement()); @NonNls String [] suffixes = new String[]{"Key", "Value"}; for (String suffix : suffixes) { if (FunctionalExpressionUtils.isFunctionalReferenceTo(arg, JAVA_UTIL_MAP_ENTRY, null, "get"+suffix, PsiType.EMPTY_ARRAY)) { String replacementMethod = "comparingBy" + suffix; @NlsSafe String comparator = "Entry." + replacementMethod + "()"; holder.registerProblem(nameElement, JavaBundle.message("inspection.simplifiable.comparator.entry.comparator.message",comparator), new ReplaceWithEntryComparatorFix(replacementMethod)); } } } if (MIN_MAX.test(call)) { PsiExpression arg = ArrayUtil.getLastElement(call.getArgumentList().getExpressions()); if (getPlainComparatorExpressionFromReversed(arg, new CommentTracker()) != null) { PsiElement nameElement = Objects.requireNonNull(call.getMethodExpression().getReferenceNameElement()); String maxOrMin = nameElement.getText(); String replacement = getMaxMinReplacement(maxOrMin); holder.registerProblem(nameElement, JavaBundle.message("inspection.simplifiable.comparator.reversed.message", maxOrMin, replacement), new ReplaceMaxMinFix(replacement)); } } }