Skip to main content

Posts

Showing posts with the label Java 8 function package

java.util.function package

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 Predicate 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 . Consumer It represents an operation accept(s) argument(s) and return void with side-effects. Java 8 introduced many versions of Consumers. Consumer BiConsumer DoubleConsumer ObjIntConsumer You can see the usage of Consumer here .