O'Reilly logo

Test-Driven Java Development - Second Edition by Viktor Farcic, Alex Garcia

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

Streams

One of the top utilities included in Java 8 are Streams. In this chapter we are going to use lambdas in combination with Streams in small code fragments, and create a test to verify them.

To better understand what Streams are, what to do, and what not to do with them, it is highly recommended to read Oracle's Stream pages. A good starting point is https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html.

To cut a long story short, Streams provide a bunch of facilities to deal with long computations that can be executed either in parallel or sequential order. Parallel programming is out of the scope of this book, so the next examples will be sequential only. Furthermore, in order to keep the chapter concise we are going ...

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