Inspectopedia Help

Method reference can be replaced with lambda

Reports method references, like MyClass::myMethod and myObject::myMethod, and suggests replacing them with an equivalent lambda expression.

Lambda expressions can be easier to modify than method references.

Example:

System.out::println

After the quick-fix is applied:

s -> System.out.println(s)

By default, this inspection does not highlight the code in the editor, but only provides a quick-fix.

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023