Cover image for Java 8 Functional Interface Cheatsheet

Java 8 Functional Interface Cheatsheet

monknomo profile image Gunnar Gissel Originally published at gunnargissel.com Updated on ・1 min read

O'Reilly has a great in-depth article on the functional interface in Java 8. Here's a quick cheat sheet to keep track of the main types, what they do and common use cases.


A Predicate returns true or false. These are used for filters or replacing big chains of if/else logic.


A Function transforms data. These are used for maps, and other transformations. It is important to not mutate the original data that is passed in.


A Supplier takes no arguments and returns a value of a known type. Fetching, reading or creating resources to be used by other functions are common use cases. Suppliers get things started.


A Consumer accepts a single argument, but does not return any results. Consumers are where mutating functions, things with side-effects, should go. Consumers finish things.

If you like this, visit my blog for more.

Get a monthly email with great tech and tech leadership articles from around the web

Thanks to Rog01 for the great robot photo


Editor guide