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.
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.
Also covered in
What to know first
- lambdaA lambda is an expression that defines an unnamed function, specifying its parameters and body and producing a callable value.
- functional programmingFunctional programming is a programming paradigm that expresses computation through the evaluation and composition of functions, typically favoring immutable data and minimizing mutable state and side effects.
- side effectA side effect is an observable change or interaction caused by a computation beyond producing its direct result, such as modifying state or interacting with the external environment.
- contractA contract is an agreed specification of the conditions, expectations, rights, or obligations that govern behavior or interactions between parties or software components.
Related concepts
- lambdaused by · A lambda is an expression that defines an unnamed function, specifying its parameters and body and producing a callable value.
- transformer interfaceincludes · Transformer is a Spring Integration interface that defines a contract for components that convert messages or their payloads.
- UserDetailsServiceincludes · UserDetailsService is a Spring Security interface for retrieving user-specific data required during authentication.
- algebraic data typeimplemented by · An algebraic data type is a composite type whose values are formed from product structures, finite alternatives, or both through type constructors.
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.


