11.1. Introduction¶
In the Interfaces chapter,
a general approach to implementing an interface was presented that
requires the explicit declaration of a new class, the implements
keyword, and method overrides.
Introduced in Java 8, a lambda expression is a special kind of expression that can be used to implement and instantiate objects of single-method classes using fewer lines of code. More precisely, a lambda expression lets us define a class that implements a functional interface and instantiate that class all using a single expression, sometimes even using a single line of code.