16. Predicates and Other Functional Interfaces

Overview

This chapter explores all the valid use cases of functional interfaces. It will first define what these interfaces are (beginning with the predicate interface), as well as how best to employ them in your code. You will then learn how to build and apply predicates, studying their composition and how to use this to model complex behavior. You will practice creating consumer interfaces to change the state of your program, and, eventually, use functions to extract useful constructs.

Introduction

Alongside the many other improvements in Java 8 (such as the streaming API, method references, optionals, and collectors) there are interface improvements that allow default and static methods ...

Get The Java Workshop 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.