CallHandler<CallChainSimplification> () { return CallHandler.of(STREAM_ANY_MATCH, call -> { PsiMethodCallExpression qualifierCall = getQualifierMethodCall(call); if (!ARRAYS_STREAM.test(qualifierCall)) return null; PsiExpression arg = skipParenthesizedExprDown(call.getArgumentList().getExpressions()[0]); if (arg instanceof PsiMethodReferenceExpression) { PsiMethod method = tryCast(((PsiMethodReferenceExpression)arg).resolve(), PsiMethod.class); if (MethodUtils.isEquals(method)) { PsiExpression qualifier = ((PsiMethodReferenceExpression)arg).getQualifierExpression(); if (qualifier != null) { return new AnyMatchContainsFix(qualifier); } } } if (arg instanceof PsiLambdaExpression lambda) { PsiParameter[] parameters = lambda.getParameterList().getParameters(); if (parameters.length != 1) return null; PsiParameter parameter = parameters[0]; PsiExpression lambdaBody = LambdaUtil.extractSingleExpressionFromBody(lambda.getBody()); EqualityCheck check = EqualityCheck.from(lambdaBody); if (check == null) return null; PsiExpression left = check.getLeft(); PsiExpression right = check.getRight(); if (ExpressionUtils.isReferenceTo(left, parameter) && ExpressionUtils.isSafelyRecomputableExpression(right)) { return new AnyMatchContainsFix(right); } if (ExpressionUtils.isReferenceTo(right, parameter) && ExpressionUtils.isSafelyRecomputableExpression(left)) { return new AnyMatchContainsFix(left); } } return null; }); }