Java 8 - Newly introduced java.util.function package

We will start with what newly introduced java.util.function and then will implement it with an example.

1. Introduction

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


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(T) argument of type T and return void with side-effects. Java 8 introduced many versions of Consumers.

You can see the usage of Consumer here.

Tags: java.util.function package, BiConsumer in Java 8, Consumer in Java 8, Function in Java 8, Predicate in Java 8, Supplier in Java 8, Java, Java 8

← Back home