Introduktion
I Java 8+ är ett funktionellt gränssnitt ett gränssnitt som bara har en abstrakt metod (bortsett från metoderna för Object). Se JLS §9.8. Funktionella gränssnitt .
Lista över funktionella gränssnitt för Java Runtime Library genom signatur
| Parametertyper | Returtyp | Gränssnitt |
|---|
| () | tomhet | Runnable |
| () | T | Leverantör |
| () | boolean | BooleanSupplier |
| () | int | IntSupplier |
| () | lång | LongSupplier |
| () | dubbel- | DoubleSupplier |
| (T) | tomhet | Konsument <T> |
| (T) | T | UnaryOperator <T> |
| (T) | R | Funktionen <T, R> |
| (T) | boolean | Predicate <T> |
| (T) | int | ToIntFunction <T> |
| (T) | lång | ToLongFunction <T> |
| (T) | dubbel- | ToDoubleFunction <T> |
| (T, T) | T | BinaryOperator <T> |
| (T, U) | tomhet | BiConsumer <T, U> |
| (T, U) | R | BiFunction <T, U, R> |
| (T, U) | boolean | BiPredicate <T, U> |
| (T, U) | int | ToIntBiFunction <T, U> |
| (T, U) | lång | ToLongBiFunction <T, U> |
| (T, U) | dubbel- | ToDoubleBiFunction <T, U> |
| (T, int) | tomhet | ObjIntConsumer <T> |
| (T, lång) | tomhet | ObjLongConsumer <T> |
| (T, dubbel) | tomhet | ObjDoubleConsumer <T> |
| (Int) | tomhet | IntConsumer |
| (Int) | R | IntFunction <R> |
| (Int) | boolean | IntPredicate |
| (Int) | int | IntUnaryOperator |
| (Int) | lång | IntToLongFunction |
| (Int) | dubbel- | IntToDoubleFunction |
| (int, int) | int | IntBinaryOperator |
| (lång) | tomhet | LongConsumer |
| (lång) | R | LongFunction <R> |
| (lång) | boolean | LongPredicate |
| (lång) | int | LongToIntFunction |
| (lång) | lång | LongUnaryOperator |
| (lång) | dubbel- | LongToDoubleFunction |
| (lång lång) | lång | LongBinaryOperator |
| (dubbel) | tomhet | DoubleConsumer |
| (dubbel) | R | DoubleFunction <R> |
| (dubbel) | boolean | DoublePredicate |
| (dubbel) | int | DoubleToIntFunction |
| (dubbel) | lång | DoubleToLongFunction |
| (dubbel) | dubbel- | DoubleUnaryOperator |
| (dubbel, dubbel) | dubbel- | DoubleBinaryOperator |