Q54: What are the primary built-in Functional Interfaces in java.util.function?

  1. Predicate<T>: boolean test(T t) — Accepts input, returns boolean.
  2. Function<T, R>: R apply(T t) — Accepts input $T$, transforms and returns result $R$.
  3. Consumer<T>: void accept(T t) — Accepts input, returns void (side-effects).
  4. Supplier<T>: T get() — Accepts no input, produces result $T$.
  5. UnaryOperator<T>: T apply(T t) — Function where input and output types match.
Key Takeaways
  • Predicate: Test condition ($T o ext{boolean}$). Function: Transform data ($T o R$). Consumer: Execute action ($T o ext{void}$). Supplier: Supply value ($emptyset o T$).
Knowledge Check

Which functional interface signature accepts an argument and returns NO output result (void)?