© Ralph Lecessi 2019
Ralph LecessiFunctional Interfaces in Javahttps://doi.org/10.1007/978-1-4842-4278-0_3

3. Predicates

Ralph Lecessi1 
(1)
Kendall Park, NJ, USA
 

Section 3.1: The java.util.function Package

In Java 8, the java.util.function package was added to the Java API. It contains many functional interfaces designed to assist with functional programming. These functional interfaces follow one of four basic models:
Table 3-1

Basic Models for java.util.function Interfaces

Model

Has Arguments

Returns a Value

Description

Predicate

yes

boolean

Tests argument and returns true or false.

Function

yes

yes

Maps one type to another.

Consumer

yes

no

Consumes input (returns nothing).

Supplier

no

yes

Generates output (using no input).

Many of the interfaces in the java.util.function ...

Get Functional Interfaces in Java: Fundamentals and Examples now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.