13.5 Functional Interfaces from the java.util.function Package
Functions implement mappings, and since different types of mappings exist, the Java standard library in the java.util.function package provides functional interfaces for the most common cases. Table 13.11 provides an overview.
|
Interface |
Mapping |
|---|---|
|
Consumer<T> |
(T) → void |
|
DoubleConsumer |
(double) → void |
|
BiConsumer<T,U> |
(T, U) → void |
|
Supplier<T> |
() → T |
|
BooleanSupplier |
() → boolean |
|
Predicate<T> |
(T) → boolean |
|
LongPredicate |
(long) → boolean |
|
BiPredicate<T,U> |
(T, U) → boolean |
|
Function<T,R> |
(T) → R |
|
LongToDoubleFunction |
(long) → double |
|
BiFunction<T,U,R> |
(T, U) → R |
|
UnaryOperator<T> ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access