Functional Interface in Java8

Publié le: 22 septembre 2018
sur la chaîne: Automation Testing By Experts
264
10

An Interface that contains exactly one abstract method is known as functional interface. It can have any number of default, static methods but can contain only one abstract method. It can also declare methods of object class.

Functional Interface is also known as Single Abstract Method Interfaces or SAM Interfaces. It is a new feature in Java, which helps to achieve functional programming approach.

@FunctionalInterface annotation is added so that we can mark an interface as functional interface.
It is not mandatory to use it, but it’s best practice to use it with functional interfaces to avoid addition of extra methods accidentally.

The major benefit of java 8 functional interfaces is that we can use lambda expressions to instantiate them and avoid using bulky anonymous class implementation.


Sur cette page du site, vous pouvez voir la vidéo en ligne Functional Interface in Java8 durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Automation Testing By Experts 22 septembre 2018, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 264 fois et il a aimé 10 téléspectateurs. Bon visionnage!