Brian

49%
Flag icon
It is a statement of programmer intent that serves three purposes: it tells readers of the class and its documentation that the interface was designed to enable lambdas; it keeps you honest because the interface won’t compile unless it has exactly one abstract method; and it prevents maintainers from accidentally adding abstract methods to the interface as it evolves. Always annotate your functional interfaces with the @FunctionalInterface annotation.
Brian
If you create a functional interface, annotate it @FunctionalInterface
Effective Java
Rate this book
Clear rating
Open Preview