Posts

A Guide to Streams in Java 8: In-Depth Tutorial with Examples

Overview The addition of the  Stream  is one of the major new functionality in Java 8. This in-depth tutorial is an introduction to the many functionalities supported by streams, with a focus on simple, practical examples. To understand this material, you need to have a basic, working knowledge of Java 8 (lambda expressions,  Optional ,  method references). Introduction First of all, Java 8 Streams should not be confused with Java I/O streams (ex:  FileInputStream  etc); these have very little to do with each other. Simply put, streams are wrappers around a data source, allowing us to operate with that data source and making bulk processing convenient and fast. A stream does not store data and, in that sense, is not a data structure. It also never modifies the underlying data source. This new functionality –  java.util.stream  – supports functional-style operations on streams of elements, such as map-reduce transformations on colle...
Recent posts