O'Reilly logo

Java: A Beginner’s Tutorial, 4th Edition (Updated for Java SE 8) by Budi Kurniawan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 20

Working with Streams

In this chapter you will learn about the Stream API, a new feature of JDK 8. To understand the topics in this chapter, you need to know how to use Lambda expressions and the predefined functional interfaces in java.util.function, both discussed in Chapter 19, “Lambda Expressions.”

Overview

A stream is like a pipe, but instead of transporting water or oil, a stream transfers data from a source to a destination. Depending on the mode of transfer, a stream can be either sequential or parallel. A parallel stream is especially useful if the computer the program is running on has a multicore CPU.

At first glance, a stream may look like a collection. However, a stream is not a data structure for storing objects, it only ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required