JavaIntermediate#java8

What is a functional interface?

An interface with exactly one abstract method. Marked optionally with @FunctionalInterface. Examples: Runnable, Callable, Comparator, Function, Predicate, Consumer, Supplier.

Example
@FunctionalInterface
interface Calculator { int operate(int a, int b); }
Calculator add = (a, b) -> a + b;
add.operate(2, 3); // 5

Related Questions

1
JavaIntermediate#java8

What is Optional?

Open
2
JavaIntermediate#concurrency

Explain multithreading and the Thread lifecycle.

Open
3
JavaAdvanced#concurrency

Difference between synchronized and volatile?

Open