Junior
What functional interfaces do you know?
sobes.tech AI
Answer from AI
Predicate<T>: Accepts an argument of typeTand returns a boolean value. Often used for filtering elements.Consumer<T>: Accepts an argument of typeTand returns nothing. Used for performing actions on elements.Supplier<T>: Takes no arguments and returns a value of typeT. Used for generating values.Function<T, R>: Accepts an argument of typeTand returns a value of typeR. Used for transforming values.UnaryOperator<T>: ExtendsFunction<T, T>, accepts an argument of typeTand returns a value of the same type.BinaryOperator<T>: ExtendsBiFunction<T, T, T>, accepts two arguments of typeTand returns a value of the same type. Often used in reduction operations.BiPredicate<T, U>: Accepts two arguments of typesTandU, returns a boolean value.BiConsumer<T, U>: Accepts two arguments of typesTandU, returns nothing.BiFunction<T, U, R>: Accepts two arguments of typesTandU, returns a value of typeR.
Additionally, there are specialized functional interfaces for primitive types (IntPredicate, LongSupplier, DoubleConsumer, etc.) to avoid auto-boxing/unboxing, as well as interfaces with a return type of void (Runnable).