Functional Interface | What is functional Interface in java 8?
A. About:
1. It can have only one single abstract method. So it is also know as SINGLE ABSTRACT METHOD (SAM).
2. Also it can have multiple default and static method.
3. We can also declare method of super Object class.
4. We have to use @FunctionalInterface annotation represent a interface as functional interface.
Example : Some predefined functional interface of JAVA
BiConsumer
Comparable
Runnable
B. Why do we need functional interface?
functional interfaces enable the use of lambda expressions, which are a concise way to represent a method as an object. They also facilitate the use of modern features such as the Stream API, parallel processing and libraries in Java 8 or later versions.
#java
#javacore
#java8
#javafunctionalinterface
#javapracticalguru