is now
Showing posts with label Supplier. Show all posts

java.util.function package

Java 8 introduced new package and introduced many functional interface. It can be divided into four categories.

  • Predicate
  • Consumer
  • Function
  • Supplier


It represents a boolean-valued function of one argument. It is a functional interface with method test(T) where T is typed.

You can see the usage here.


It represents an operation accept(s) argument(s) and return void with side-effects. Java 8 introduced many versions of Consumers.

You can see the usage of Consumer here.