PsiElementPredicate () { return e -> { if (!(e instanceof PsiMethodCallExpression methodCallExpression)) { return false; } final PsiMethod method = methodCallExpression.resolveMethod(); if (method == null) { return false; } final PsiClass aClass = method.getContainingClass(); if (aClass == null) { return false; } final String qualifiedName = aClass.getQualifiedName(); if (qualifiedName == null || !qualifiedName.equals("java.util.Collections")) { return false; } final String name = method.getName(); return (replacementText = getReplacementMethodText(name, methodCallExpression)) != null; }; }