The method parameter needs to be a Functional interface of the type of the method reference.

MyMethod(() -> "Hello, World!");

Supplier<String> supplier = () -> "Hello, World!";
MyMethod(supplier);
MyMethod(supplier::get);
MyMethod2(supplier.get());


public static void MyMethod(Supplier<String> sup) {
    System.out.println(sup.get());
}

public static void MyMethod2(String value) {
    System.out.println(value);
}

prints

Hello, World!
Hello, World!
Hello, World!
Hello, World!
Answer from WJS on Stack Overflow
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › csharp › language-reference › operators › lambda-expressions
Lambda expressions - Lambda expressions and anonymous functions - C# reference | Microsoft Learn
If you're querying an ... of parameters as the delegate type. Each input parameter in the lambda must be implicitly convertible to its corresponding delegate parameter....
🌐
Blogger
javarevisited.blogspot.com › 2017 › 08 › how-to-convert-lambda-expression-to-method-reference-in-java8-example.html
How to Convert a Lambda Expression to Method Reference in Java 8?
P. S. - If you don't mind learning ... said... Hi, SonarLint helps finding where a lambda expression can be replaced by method reference....
🌐
JetBrains
jetbrains.com › help › resharper › ConvertToLambdaExpression.html
Code inspection: Convert into lambda expression | ReSharper Documentation
April 8, 2024 - In the example below, ReSharper suggests assigning a lambda expression to the sum delegate instead of using a longer anonymous method: class MyClass { public static int MyMethod() { Func<int, int, int> sum = delegate(int x, int y) { return x + y; }; return sum(10, 20); } } class MyClass { public static int MyMethod() { Func<int, int, int> sum = (x, y) => x + y; return sum(10, 20); } } In the following example, ReSharper suggests converting a statement lambda to a lambda expression:
🌐
LinkedIn
linkedin.com › learning › advanced-python › lambda-functions
Lambda functions - Python Video Tutorial | LinkedIn Learning, formerly Lynda.com
And, then for the FahrenheitToCelsius case, I will copy this expression and paste it in here. And, I have to change that to t 'cause it's not temp anymore. And, the same thing here. I'll write lambda t, and now I will get the CelsiusToFahrenheit version. So, I'll copy that, paste it in, and change that to t. All right, so now you can see that the results are the same.
Published   August 15, 2018
Views   203K
🌐
LinkedIn
linkedin.com › pulse › c-converting-string-datetime-data-type-inside-linq-jeffrey-ferreiras
C# Converting String DateTime to DateTime data-type inside a LINQ expression.
October 27, 2017 - 2. In the lambda/LINQ expression use your method after enumerating the values of the date-time in string format. IE... List<string> GetSetID(DateTime start, DateTime end, string client) { List<string> setsid = EE.fcrhdrs.Where (f => ...
🌐
Oracle
docs.oracle.com › javase › tutorial › java › javaOO › lambdaexpressions.html
Lambda Expressions (The Java™ Tutorials > Learning the Java Language > Classes and Objects)
In these cases, you're usually trying to pass functionality as an argument to another method, such as what action should be taken when someone clicks a button. Lambda expressions enable you to do this, to treat functionality as method argument, or code as data.
Find elsewhere
🌐
Java Code Geeks
javacodegeeks.com › home › core java
How to convert a lambda expression to method reference in Java 8? - Java Code Geeks
August 14, 2017 - That’s it, but I know, it’s ... function but not doing anything with the argument passed, you can replace lambda expression with method reference....
🌐
Medium
medium.com › @bubu.tripathy › effective-lambda-expressions-in-java-2d4061dde77a
Effective Lambda Expressions in Java | by Bubu Tripathy | Medium
March 11, 2023 - We pass a lambda expression that returns the default value “default”. Since the Optional object is empty, the orElseGet() method returns the default value, which we then print to the console. Thanks for your Attention! Happy Learning! ... Crafting intelligent, cloud-native, and API-driven solutions for the modern enterprise. LinkedIn:https://www.linkedin.com/in/bubu-tripathy-8682187/
🌐
JetBrains
jetbrains.com › help › resharper › ConvertClosureToMethodGroup.html
Code inspection: Convert lambda expression into method group | ReSharper Documentation
April 8, 2024 - This syntax does not require explicitly invoking the delegate's constructor. Method groups allow using overloads of the method. Which overload to invoke is determined by the delegate’s signature. If an anonymous function (expression lambda or anonymous method) consists of only one method, it is possible to convert it to a method group to achieve more compact syntax and prevent compile-time overhead caused by using lambdas.
🌐
Medium
medium.com › @mesfandiari77 › method-reference-in-java-simplifying-lambda-expressions-c05be4993b69
Method Reference in Java: Simplifying Lambda Expressions | by MEsfandiari | Medium
July 20, 2023 - Method reference is a shorthand syntax for writing lambda expressions that refer to an existing method. Instead of defining a lambda expression that calls a method, you can use method reference to refer to the method directly.
🌐
Essentialcsharp
essentialcsharp.com › lambda-expressions
Essential C#: Lambda Expressions
When reading code that includes a lambda operator, you would replace the lambda operator with the words go/goes to. For example, in Listing 13.12, you would read the second BubbleSort() parameter as “integers first and second go to returning ...
🌐
Baeldung
baeldung.com › home › java › core java › convert anonymous class into lambda in java
Convert Anonymous Class into Lambda in Java | Baeldung
May 29, 2025 - In this tutorial, we’ll learn how to convert an anonymous class into a lambda expression in Java.
🌐
OpenJDK
cr.openjdk.org › ~briangoetz › lambda › lambda-translation.html
Translation of Lambda Expressions
When the compiler encounters a ... into a method whose argument list and return type match that of the lambda expression, possibly with some additional arguments (for values captured from the lexical scope, if any.) At the point at which the lambda expression would be captured, it generates an invokedynamic call site, which, when invoked, returns an instance of the functional interface to which the lambda is being converted. This call site ...
🌐
Baeldung
baeldung.com › home › java › lambda expressions and functional interfaces: tips and best practices
Lambda Expressions and Functional Interfaces: Tips and Best Practices | Baeldung
December 16, 2023 - In this situation, it is very useful to use another Java 8 feature, method references. ... This is not always shorter, but it makes the code more readable. Accessing a non-final variable inside lambda expressions will cause a compile-time error, but that doesn’t mean that we should mark every target variable as final.
🌐
Hevo
hevodata.com › home › learn › data strategy
C# Lambda Expressions: Syntax and Practical Examples | Hevo
January 9, 2026 - The Input Parameters are specified on the left side of the Lambda Operator, while the right side contains an expression or a code block that works with the entry arguments. Lambda expressions are commonly used as predicates or instead of delegates (a type that references a method). In this article and code examples, you will see how to implement C# Lambda function in different Use Cases.
🌐
W3Schools
w3schools.com › java › java_lambda.asp
Java Lambda Expressions
A lambda expression is a short block of code that takes in parameters and returns a value. Lambdas look similar to methods, but they do not need a name, and they can be written right inside a method body.