© Ralph Lecessi 2019
Ralph LecessiFunctional Interfaces in Javahttps://doi.org/10.1007/978-1-4842-4278-0_12

12. Use in Streams

Ralph Lecessi1 
(1)
Kendall Park, NJ, USA
 
The Stream interface provides chainable operations that can be performed on a series of values. A Stream is generic for type parameter X which is the type of its values.
public interface Stream<T> extends BaseStream<T, Stream<T> >
{
    ...
}

An object that implements the Stream interface is like an Optional that can contain several values instead of just one. Stream has many of the same methods defined in the Optional class including of, filter, and map.

Since many of the methods in the Stream interface return streams, very powerful chains of streams can be created.

Section 12.1: Generating ...

Get Functional Interfaces in Java: Fundamentals and Examples 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.