IntelliJ IDEA Tips & Tricks #47: Convert a anonymous inner class object into lambda

Опубликовано: 28 Сентябрь 2024
на канале: CodeOpsTech
242
5

A simple example of anonymous inner class object is a Runnable object. Runnable is an interface with a single method run. So it is a "functional interface" - i.e., you can use lambdas instead of creating objects.

In IntelliJ IDEA, you can alt + enter and transform the anonymous innner class object to the equivalent lambda and back. This video demonstrates it in action.