Introduction
Dans Java 8+, une interface fonctionnelle est une interface qui ne comporte qu’une seule méthode abstraite (hormis les méthodes de Object). Voir JLS §9.8. Interfaces Fonctionnelles .
Liste des interfaces fonctionnelles standard de Java Runtime Library par signature
Types de paramètres | Type de retour | Interface |
---|
() | vide | Runnable |
() | T | Fournisseur |
() | booléen | BooleanSupplier |
() | int | IntSupplier |
() | longue | LongSupplier |
() | double | DoubleSupplier |
(T) | vide | Consommateur <T> |
(T) | T | UnaryOperator <T> |
(T) | R | Fonction <T, R> |
(T) | booléen | Prédicat <T> |
(T) | int | ToIntFunction <T> |
(T) | longue | ToLongFunction <T> |
(T) | double | ToDoubleFunction <T> |
(T, T) | T | BinaryOperator <T> |
(T, U) | vide | BiConsumer <T, U> |
(T, U) | R | BiFunction <T, U, R> |
(T, U) | booléen | BiPredicate <T, U> |
(T, U) | int | ToIntBiFunction <T, U> |
(T, U) | longue | ToLongBiFunction <T, U> |
(T, U) | double | ToDoubleBiFunction <T, U> |
(T, int) | vide | ObjIntConsumer <T> |
(T, long) | vide | ObjLongConsumer <T> |
(T, double) | vide | ObjDoubleConsumer <T> |
(int) | vide | IntConsumer |
(int) | R | IntFunction <R> |
(int) | booléen | IntPredicate |
(int) | int | IntUnaryOperator |
(int) | longue | IntToLongFunction |
(int) | double | IntToDoubleFunction |
(int, int) | int | IntBinaryOperator |
(longue) | vide | LongConsumer |
(longue) | R | LongFunction <R> |
(longue) | booléen | LongPredicate |
(longue) | int | LongToIntFunction |
(longue) | longue | LongUnaryOperator |
(longue) | double | LongToDoubleFunction |
(long, long) | longue | LongBinaryOperator |
(double) | vide | DoubleConsumer |
(double) | R | DoubleFunction <R> |
(double) | booléen | DoublePredicate |
(double) | int | DoubleToIntFunction |
(double) | longue | DoubleToLongFunction |
(double) | double | DoubleUnaryOperator |
(double double) | double | DoubleBinaryOperator |