Chapter 3. Lambdas in Depth

In this section, we'll take a look at things in a little more detail and talk about some related topics, things like:

  • Functional interfaces
  • Method and constructor references
  • Scope and effectively final variables
  • Exception transparency
  • The differences between lambdas and closures
  • As we've talked about how lambdas aren't just syntactic sugar, we'll have a look at the bytecode lambdas produce

Functional interfaces

Java treats lambdas as an instance of an interface type. It formalizes this into something it calls functional interfaces. A functional interface is just an interface with a single method. Java calls the method a "functional method" but the name "single abstract method" or SAM is often used.

All the existing single method ...

Get Learning Java Lambdas now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.