Summary
In this chapter, you've explored how to use the functional interfaces provided by Java 8. You've used them both in loops, on single instances, and in streams—all of which are valid use cases for functional interfaces. However, you'll quickly find that these instances of functional interfaces (lamdas, for short) are more commonly used together with streams.
There are many pre-defined functional interfaces in Java, but only a few of them are unique in the way they work. Most are just primitive versions of the different functions, such as IntPredicate
, LongPredicate
, DoublePredicate
, and Predicate
.
In the next chapter, you'll learn more about the Reactive Streams initiative, the Flow API, and what Java does to build good foundational interfaces for reactive programming.