Summary

The use of streams is considered to be one aspect of functional programming languages. In this chapter, we addressed the use of streams as supported by Java 8. We demonstrated the creation and use of finite and infinite streams. These depend on some data source, which might be bounded in length as with arrays or indefinite if derived from a source such as a network connection.

The Stream class supports the stream concept in Java. While it possesses many methods, we covered only a few with the goal of imparting a feel for the use and power of streams. We examined the filter, skip, and sorted methods and used them in several examples. We demonstrated the popular map-reduce technique, which potentially modifies a set of data and then combines ...

Get Learning Java Functional Programming 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.