liveBook · Manning

Functional interface

A functional interface is an interface with exactly one abstract operation, making it compatible with implementation by a function, lambda expression, or method reference.

How 3 Manning books explain it

Functional Design and Architecture: Examples in Haskell

A functional interface is an abstraction defining communication between subsystems through functional representations rather than object-oriented method dispatch.

How it is used
Uses functional interfaces to separate subsystem communication and business logic from implementation details.
How deep it goes
Defines abstract-type interfaces and works through service handles and interpretable free-monad scenarios, alongside alternative representations.
Examples
Demonstrates a hardware device translator, greeting service handles, and an astronomy reporting interface.
What you can do after
Apply functional interfaces to hide subsystem details, inject implementations, and substitute mocks in tests.

Read how Functional Design and Architecture: Examples in Haskell explains functional interface →

Kotlin in Action, 2E

A functional interface is an interface with exactly one abstract method, allowing it to be implemented by a function value or lambda in compatible contexts.

How it is used
Enables concise Kotlin callbacks for Java APIs and named Kotlin behavior contracts.
How deep it goes
Explains automatic and explicit SAM conversion, allocation effects of captures, and self-unregistering listener limits.
Examples
Uses button click listeners, Runnable postponement, reusable listeners, and an IntCondition predicate with helper methods.
What you can do after
Apply it via Kotlin lambdas and SAM constructors when calling or defining Java- and Kotlin-facing callback APIs.

Read how Kotlin in Action, 2E explains functional interface →

The Art of Code

A functional interface is a Java interface with one abstract method that can serve as the target type for a lambda expression or method reference.

How it is used
Represents small input-to-output behavior so Java can pass it through lambdas, method references, and functional pipelines.
How deep it goes
Defines the single-abstract-method rule, optional compiler enforcement, and standard alternatives, but stops short of broader interface mechanics.
Examples
Uses StringPredicate, LengthGreaterThanThree, Predicate, and a stream filtering words longer than three characters.
What you can do after
Apply Java lambdas to replace trivial implementation classes and express reusable transformations with matching functional-interface signatures.

Read how The Art of Code explains functional interface →

Also covered in

What to know first

Related concepts

Questions about functional interface

What is functional interface?

A functional interface is an interface with exactly one abstract operation, making it compatible with implementation by a function, lambda expression, or method reference.

Which Manning books explain functional interface?

Functional Design and Architecture: Examples in Haskell, Kotlin in Action, 2E and The Art of Code.

What should I know before learning functional interface?

Manning books that teach functional interface usually introduce lambda, functional programming, side effect and contract first.

What kinds of functional interface are there?

Kinds of functional interface include OnClickListener, transformer interface and UserDetailsService.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.