0% found this document useful (0 votes)
8 views1 page

java_functional_interfaces

java_functional_interfaces

Uploaded by

edelisakson
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

java_functional_interfaces

java_functional_interfaces

Uploaded by

edelisakson
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Functional Interfaces Cheat Sheet (package: java.util.

function)
Provide target types for lambda expressions and method references.

Primitive Type Prefixes

For: Predicate, Function, Consumer, UnaryOperator and BinaryOperator


Interfaces Arguments Return
When accepts primitive arguments (int, double, long) the interface is prefixed with Int,
Predicate<T> T Double, Long, e.g., LongConsumer, IntFunction, DoubleBinaryOperator.
boolean
BiPredicate<T, U> T, U
For: Supplier
Function<T, R> T
R The only interface that returns boolean primitive, apart from predicate, is
BiFunction<T, U, R> T, U BooleanSupplier.

Supplier<T> − T
For BiConsumer
Consumer<T> T Variants that accept an object and a primitive: ObjDoubleConsumer, ObjIntConsumer,
− ObjLongConsumer.
BiConsumer<T, U> T, U

For: Function and BiFunction


Special Interfaces Arguments Return When returns a primitive (int, double, long) it is prefixed with ToInt, ToDouble, ToLong,
e.g., ToIntFunction, ToDoubleBiFunction.
UnaryOperator<T> T
T
BinaryOperator<T> T, T For: Function
When accepts a primitive and returns another primitive, both prefixes are joined,
e.g., IntToDoubleFunction, LongToIntFunction.

www.theagilecrafter.com @AgileCrafter

You might also like