PsiExpression (TerminalBlock tb) { PsiMethodCallExpression call = tb.getSingleMethodCall(); if(call == null) return null; PsiExpression[] args = call.getArgumentList().getExpressions(); if(args.length != 1) return null; PsiExpression arg = args[0]; if(ExpressionUtils.isReferenceTo(arg, tb.getVariable())) return null; if(PsiTypes.voidType().equals(arg.getType())) return null; PsiExpression qualifier = call.getMethodExpression().getQualifierExpression(); if(tb.dependsOn(qualifier) || VariableAccessUtils.variableIsUsed(tb.getVariable(), qualifier) || StreamApiMigrationInspection.isExpressionDependsOnUpdatedCollections(arg, qualifier) || !LambdaCanBeMethodReferenceInspection.checkQualifier(qualifier)) return null; return arg; }